Skip to content

Commit

Permalink
Add another condition
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Jan 13, 2025
1 parent ba7d98d commit 62b2602
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion membership.lua
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ local function mark_left(uri_to_leave)

-- Perform artificial events.generate() and instantly send it
local myself = members.get(uri_to_leave)
if not myself then
if not myself or myself.status == opts.LEFT then
return false
end
local event = events.pack({
Expand Down
6 changes: 6 additions & 0 deletions test/test_quit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ def test_mark_left(servers, helpers):
helpers.wait_for(servers[13301].check_status, ['localhost:13302', 'alive'])
assert servers[13301].conn.eval('return membership.mark_left("localhost:13302")')[0]
helpers.wait_for(servers[13301].check_status, ['localhost:13302', 'left'])

# already has left
assert not servers[13301].conn.eval('return membership.mark_left("localhost:13302")')[0]

# there are no such member
assert not servers[13301].conn.eval('return membership.mark_left("localhost:10000")')[0]

0 comments on commit 62b2602

Please sign in to comment.