Skip to content

Commit

Permalink
Add a SIGKILL to second ctrl+c (#2621)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Dec 14, 2022
1 parent db39e12 commit 064168f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sanic/worker/manager.py
@@ -1,5 +1,6 @@
import os

from contextlib import suppress
from itertools import count
from random import choice
from signal import SIGINT, SIGTERM, Signals
Expand Down Expand Up @@ -92,7 +93,6 @@ def run(self):
self.monitor()
self.join()
self.terminate()
# self.kill()

def start(self):
for process in self.processes:
Expand Down Expand Up @@ -238,6 +238,11 @@ def kill(self):
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()
Expand Down

0 comments on commit 064168f

Please sign in to comment.