Test shutdown.

This commit is contained in:
yohan 2024-06-07 02:46:18 +02:00
parent fa1f7cfd97
commit 7e674b165a

View File

@ -162,9 +162,14 @@ stop = Event()
def handler(signum, frame): def handler(signum, frame):
global stop global stop
global t1
global dbconn
logging.info("Got interrupt: "+str(signum)) logging.info("Got interrupt: "+str(signum))
stop.set() stop.set()
logging.info("Shutdown") logging.info("Shutdown")
t1.join()
dbconn.close()
exit(0)
signal.signal(signal.SIGTERM,handler) signal.signal(signal.SIGTERM,handler)
signal.signal(signal.SIGINT,handler) signal.signal(signal.SIGINT,handler)
@ -383,9 +388,6 @@ def thermostat_loop():
time.sleep(load_shedder_interval) time.sleep(load_shedder_interval)
logging.info("====== Ended successfully ======") logging.info("====== Ended successfully ======")
xprint('toto1')
t1 = Thread(target=thermostat_loop) t1 = Thread(target=thermostat_loop)
t1.start() t1.start()
xprint('toto2')
gunicorn_app = app gunicorn_app = app
xprint('toto3')