Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SIGKILL to second ctrl+c #2621

Merged
merged 5 commits into from Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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()

ahopkins marked this conversation as resolved.
Show resolved Hide resolved
logger.info("Received signal %s. Shutting down.", Signals(signal).name)
self.monitor_publisher.send(None)
self.shutdown()
Expand Down