Add a SIGKILL to second ctrl+c (#2621)
This commit is contained in:
parent
db39e127bf
commit
064168f3c8
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from contextlib import suppress
|
||||||
from itertools import count
|
from itertools import count
|
||||||
from random import choice
|
from random import choice
|
||||||
from signal import SIGINT, SIGTERM, Signals
|
from signal import SIGINT, SIGTERM, Signals
|
||||||
|
@ -92,7 +93,6 @@ class WorkerManager:
|
||||||
self.monitor()
|
self.monitor()
|
||||||
self.join()
|
self.join()
|
||||||
self.terminate()
|
self.terminate()
|
||||||
# self.kill()
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
for process in self.processes:
|
for process in self.processes:
|
||||||
|
@ -238,6 +238,11 @@ class WorkerManager:
|
||||||
raise ServerKilled
|
raise ServerKilled
|
||||||
|
|
||||||
def shutdown_signal(self, signal, frame):
|
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)
|
logger.info("Received signal %s. Shutting down.", Signals(signal).name)
|
||||||
self.monitor_publisher.send(None)
|
self.monitor_publisher.send(None)
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user