Skip to content

Commit d1075ed

Browse files
Fix error in protocol step (#75)
1 parent 73d65c5 commit d1075ed

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Protocol step error when the members list were cleared in process.
12+
913
## [2.5.0] - 2025-03-06
1014

1115
### Added

membership.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,16 +514,18 @@ local function _protocol_step()
514514
if sent_indirect > 0 then
515515
ack_data = wait_ack(uri, loop_now, opts.PROTOCOL_PERIOD_SECONDS * 1.0e6)
516516
end
517+
518+
-- check again in case if members list has been cleared
519+
local member = members.get(uri)
520+
if member == nil then
521+
return
522+
end
517523
if sent_indirect > 0 and ack_data ~= nil then
518-
local member = members.get(uri)
519-
if member == nil then
520-
return
521-
end
522524
-- calculate time difference between local time and member time
523525
local delta = _get_clock_delta(ack_data)
524526
members.set(uri, member.status, member.incarnation, { clock_delta = delta })
525527
return
526-
elseif members.get(uri).status == opts.ALIVE then
528+
elseif member.status == opts.ALIVE then
527529
local myself = members.get(advertise_uri)
528530
if myself.status ~= opts.ALIVE then
529531
opts.log_debug('Could not reach node: %s (%s myself)', uri, myself.status)

0 commit comments

Comments
 (0)