Merge "Fix node state checks after aquiring lock"

This commit is contained in:
Zuul 2018-09-04 14:04:00 +00:00 committed by Gerrit Code Review
commit 271f2e9a5f
1 changed files with 12 additions and 6 deletions

View File

@ -553,8 +553,10 @@ class CleanupWorker(BaseCleanupWorker):
continue
# Double check the state now that we have a lock since it
# may have changed on us.
if node.state != zk.READY:
# may have changed on us. We keep using the original node
# since it's holding the lock.
_node = zk_conn.getNode(node.id)
if _node.state != zk.READY:
zk_conn.unlockNode(node)
continue
@ -605,8 +607,10 @@ class CleanupWorker(BaseCleanupWorker):
continue
# Double check the state now that we have a lock since it
# may have changed on us.
if node.state != zk.HOLD:
# may have changed on us. We keep using the original node
# since it's holding the lock.
_node = zk_conn.getNode(node.id)
if _node.state != zk.HOLD:
zk_conn.unlockNode(node)
continue
@ -716,8 +720,10 @@ class DeletedNodeWorker(BaseCleanupWorker):
continue
# Double check the state now that we have a lock since it
# may have changed on us.
if node.state not in cleanup_states:
# may have changed on us. We keep using the original node
# since it's holding the lock.
_node = zk_conn.getNode(node.id)
if _node.state not in cleanup_states:
zk_conn.unlockNode(node)
continue