Ensure lock list isn't mutated while iterating

While iterating over the acquired lock list we
do not want the lock.release call to mutate the
list that we are currently iterating over. To fix
this just iterate over a copy instead so that the
lock.release can remove without issue.

Change-Id: I157331ca116b97e17d10854b5227ac7ee67fac57
This commit is contained in:
Joshua Harlow 2014-09-10 23:17:45 -07:00
parent beb73ba651
commit 9b81673302
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ class MemcachedDriver(coordination.CoordinationDriver):
self.heartbeat()
def stop(self):
for lock in self._acquired_locks:
for lock in list(self._acquired_locks):
lock.release()
self.client.delete(self._encode_member_id(self._member_id))