Make cleanup function more robust
This commit is contained in:
parent
264e69fbf8
commit
405a3a8f38
6
pvcd.py
6
pvcd.py
|
@ -148,7 +148,11 @@ def cleanup(signum, frame):
|
||||||
# Set stop state in Zookeeper
|
# Set stop state in Zookeeper
|
||||||
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'stop' })
|
zkhandler.writedata(zk_conn, { '/nodes/{}/daemonstate'.format(myhostname): 'stop' })
|
||||||
# Close the Zookeeper connection
|
# Close the Zookeeper connection
|
||||||
zk_conn.close()
|
try:
|
||||||
|
zk_conn.stop()
|
||||||
|
zk_conn.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
# Stop keepalive thread
|
# Stop keepalive thread
|
||||||
stopKeepaliveTimer(update_timer)
|
stopKeepaliveTimer(update_timer)
|
||||||
# Exit
|
# Exit
|
||||||
|
|
Loading…
Reference in New Issue