From 7e674b165a4aad4c263dfcae889b5fc924fb3326 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Fri, 7 Jun 2024 02:46:18 +0200 Subject: [PATCH] Test shutdown. --- thermostat.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/thermostat.py b/thermostat.py index 0841417..d627bfd 100755 --- a/thermostat.py +++ b/thermostat.py @@ -162,9 +162,14 @@ stop = Event() def handler(signum, frame): global stop + global t1 + global dbconn logging.info("Got interrupt: "+str(signum)) stop.set() logging.info("Shutdown") + t1.join() + dbconn.close() + exit(0) signal.signal(signal.SIGTERM,handler) signal.signal(signal.SIGINT,handler) @@ -383,9 +388,6 @@ def thermostat_loop(): time.sleep(load_shedder_interval) logging.info("====== Ended successfully ======") -xprint('toto1') t1 = Thread(target=thermostat_loop) t1.start() -xprint('toto2') gunicorn_app = app -xprint('toto3')