ops forgot to check signum

This commit is contained in:
əlemi 2021-12-17 16:36:38 +01:00
parent 021d35be6a
commit 2acabbfb8d

View file

@ -22,13 +22,14 @@ class Runnable:
DONE = asyncio.Event()
FORCE_QUIT = asyncio.Event()
def signal_handler():
if DONE.is_set():
logging.info("Received SIGINT, terminating")
FORCE_QUIT.set()
else:
logging.info("Received SIGINT, stopping gracefully...")
DONE.set()
def signal_handler(signum, __):
if signum == SIGINT:
if DONE.is_set():
logging.info("Received SIGINT, terminating")
FORCE_QUIT.set()
else:
logging.info("Received SIGINT, stopping gracefully...")
DONE.set()
signal(SIGINT, signal_handler)