Modify atexit trigger to work better
This commit is contained in:
parent
4881a93758
commit
90801858f4
14
pvcd.py
14
pvcd.py
|
@ -113,16 +113,12 @@ def zk_listener(state):
|
||||||
|
|
||||||
zk.add_listener(zk_listener)
|
zk.add_listener(zk_listener)
|
||||||
|
|
||||||
|
@atexit.register
|
||||||
def cleanup():
|
def cleanup():
|
||||||
try:
|
update_timer.shutdown()
|
||||||
update_timer.shutdown()
|
zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
||||||
zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii'))
|
zk.stop()
|
||||||
zk.stop()
|
zk.close()
|
||||||
zk.close()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
atexit.register(cleanup)
|
|
||||||
|
|
||||||
# Gather useful data about our host for staticdata
|
# Gather useful data about our host for staticdata
|
||||||
# Static data format: 'cpu_count', 'arch', 'os', 'kernel'
|
# Static data format: 'cpu_count', 'arch', 'os', 'kernel'
|
||||||
|
|
Loading…
Reference in New Issue