diff --git a/membership.lua b/membership.lua index 14fa0de..9b31d9b 100755 --- a/membership.lua +++ b/membership.lua @@ -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({ diff --git a/test/test_quit.py b/test/test_quit.py index 2b5af12..54a7161 100644 --- a/test/test_quit.py +++ b/test/test_quit.py @@ -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]