Add a SIGKILL to second ctrl+c (#2621)

This commit is contained in:
Adam Hopkins 2022-12-14 23:51:11 +02:00 committed by GitHub
parent db39e127bf
commit 064168f3c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import os
from contextlib import suppress
from itertools import count
from random import choice
from signal import SIGINT, SIGTERM, Signals
@ -92,7 +93,6 @@ class WorkerManager:
self.monitor()
self.join()
self.terminate()
# self.kill()
def start(self):
for process in self.processes:
@ -238,6 +238,11 @@ class WorkerManager:
raise ServerKilled
def shutdown_signal(self, signal, frame):
if self.terminated:
logger.info("Shutdown interrupted. Killing.")
with suppress(ServerKilled):
self.kill()
logger.info("Received signal %s. Shutting down.", Signals(signal).name)
self.monitor_publisher.send(None)
self.shutdown()