Make cleanup function more robust

This commit is contained in:
Joshua Boniface 2018-06-27 23:37:39 -04:00
parent 264e69fbf8
commit 405a3a8f38
1 changed files with 5 additions and 1 deletions

View File

@ -148,7 +148,11 @@ def cleanup(signum, frame):
# Set stop state in Zookeeper
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'stop' })
# Close the Zookeeper connection
zk_conn.close()
try:
zk_conn.stop()
zk_conn.close()
except:
pass
# Stop keepalive thread
stopKeepaliveTimer(update_timer)
# Exit