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() DONE = asyncio.Event()
FORCE_QUIT = asyncio.Event() FORCE_QUIT = asyncio.Event()
def signal_handler(): def signal_handler(signum, __):
if DONE.is_set(): if signum == SIGINT:
logging.info("Received SIGINT, terminating") if DONE.is_set():
FORCE_QUIT.set() logging.info("Received SIGINT, terminating")
else: FORCE_QUIT.set()
logging.info("Received SIGINT, stopping gracefully...") else:
DONE.set() logging.info("Received SIGINT, stopping gracefully...")
DONE.set()
signal(SIGINT, signal_handler) signal(SIGINT, signal_handler)