INNER CODE UNIT · Python
init_signals
br3ndonland/inboard · inboard/gunicorn_workers.py:91
def init_signals(self) -> None:
# Reset signals so Gunicorn doesn't swallow subprocess return codes
# See: https://github.com/encode/uvicorn/issues/894
for s in self.SIGNALS:
_ = signal.signal(s, signal.SIG_DFL)
# Server.capture_signals() restores these handlers and replays signals
# after ASGI shutdown. Default handlers would bypass Gunicorn cleanup
# and Python exit hooks (including coverage.py's data saving).
_ = signal.signal(signal.SIGTERM, self.handle_exit)
_ = signal.signal(signal.SIGINT, self.handle_quit)
_ = signal.signal(signal.SIGUSR1, self.handle_usr1)
# Don't let SIGUSR1 disturb active requests by interrupting system calls
signal.siginterrupt(signal.SIGUSR1, False)
def _install_sigquit_handler(self) -> None:
"""Install a SIGQUIT handler on workers.