Heartbeat on acquired locks copy
Instead of heartbeating on a collection that may be changing size while iterating ensure that we only iterate over a copy (that won't change size) during iteration. The python set() docs say that it is inherently unpredictable to iterate on a set while its being mutated so we should try to avoid that kind of case if we can. Change-Id: I6f103a5528b3f62f1c8d9e501e8cadff4221ee40
This commit is contained in:
parent
e4bbade4ef
commit
16490e5d82
|
@ -434,7 +434,7 @@ class RedisDriver(coordination.CoordinationDriver):
|
|||
expiry_ms = max(0, int(self.membership_timeout * 1000.0))
|
||||
self._client.psetex(beat_id, time_ms=expiry_ms,
|
||||
value=b"Not dead!")
|
||||
for lock in self._acquired_locks:
|
||||
for lock in self._acquired_locks.copy():
|
||||
try:
|
||||
lock.heartbeat()
|
||||
except coordination.ToozError:
|
||||
|
|
Loading…
Reference in New Issue