On lock removal validate that they key was actually deleted
Instead of assuming the lock was released (when it might have not been) be more reliable and return whether it really was or was not by validating the reply. Change-Id: I70b2e1946d5101c7fbbf4ed9f15007bb98e92581
This commit is contained in:
parent
90792db9d4
commit
fab18f8c80
@ -67,8 +67,11 @@ class MemcachedLock(locking.Lock):
|
||||
raise Retry
|
||||
|
||||
def release(self):
|
||||
self.coord._acquired_locks.remove(self)
|
||||
return bool(self.coord.client.delete(self.name))
|
||||
if self.coord.client.delete(self.name, noreply=False):
|
||||
self.coord._acquired_locks.remove(self)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def heartbeat(self):
|
||||
"""Keep the lock alive."""
|
||||
|
Loading…
Reference in New Issue
Block a user