From 90801858f4077c857b6dd60852c96cfa32677e24 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 16 Jun 2018 22:26:19 -0400 Subject: [PATCH] Modify atexit trigger to work better --- pvcd.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pvcd.py b/pvcd.py index b66718dc..ae76e47f 100755 --- a/pvcd.py +++ b/pvcd.py @@ -113,16 +113,12 @@ def zk_listener(state): zk.add_listener(zk_listener) +@atexit.register def cleanup(): - try: - update_timer.shutdown() - zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii')) - zk.stop() - zk.close() - except: - pass - -atexit.register(cleanup) + update_timer.shutdown() + zk.set('/nodes/{}/daemonstate'.format(myhostname), 'stop'.encode('ascii')) + zk.stop() + zk.close() # Gather useful data about our host for staticdata # Static data format: 'cpu_count', 'arch', 'os', 'kernel'