INNER CODE UNIT · Python

_install_sigquit_handler

br3ndonland/inboard · inboard/gunicorn_workers.py:106

    def _install_sigquit_handler(self) -> None:
        """Install a SIGQUIT handler on workers.

        - https://github.com/encode/uvicorn/issues/1116
        - https://github.com/benoitc/gunicorn/issues/2604
        """

        loop = asyncio.get_running_loop()
        loop.add_signal_handler(signal.SIGQUIT, self.handle_quit, signal.SIGQUIT, None)

    async def _serve(self) -> None:
        self.config.app = self.wsgi
        server = Server(config=self.config)
        self._install_sigquit_handler()
        # Uvicorn exits with status 3 on startup failure, matching Gunicorn's
        # WORKER_BOOT_ERROR and stopping the arbiter instead of respawning.
        await server.serve(sockets=self.sockets)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…