Fix for age calculation on unused nodes

Setting the node state automatically changes the state_time
attribute for us, so our age calculation is always at 0 when
we go to log how old the node is at delete time. Fix it so
that we set state *after* logging the age.

Change-Id: I6e0510405f43842529c733110378b96decb88a07
This commit is contained in:
David Shrewsbury 2018-02-06 09:10:25 -05:00
parent 0ff94fa98b
commit f1f55e4638

View File

@ -1691,10 +1691,10 @@ class ZooKeeper(object):
self.unlockNode(node) self.unlockNode(node)
continue continue
node.state = DELETING
try: try:
self.log.debug("Deleting unused node %s (age: %s)", self.log.debug("Deleting unused node %s (age: %s)",
node.id, age(node.state_time)) node.id, age(node.state_time))
node.state = DELETING
self.storeNode(node) self.storeNode(node)
except Exception: except Exception:
self.log.exception( self.log.exception(