-
Notifications
You must be signed in to change notification settings - Fork 92
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
Allow signaling shutdown during startup lifespan event when using Trio #213
Conversation
… during startup error after shutdown should display exception text, if exception group contains only one exception - unpack it (Trio)
I'm not sure what you are trying to achieve here? I'm also fairly certain the ASGI spec does not allow a shutdown message during startup. |
In some scenarios the server encounters an exception during its startup phase (e.g. trying to fetch some configuration data or similar, without which the various routes cannot function etc.). In the current code, even though such an exception basically means that the server is not functional, the server proceeds to finish loading then wait for incoming requests. The change I'm proposing allows such an exception to lead to a proper failure of the server instead of it proceeding as if nothing happened (which leads to a running, but "broken" server). This is a real-life scenario we are facing. In our case, certain things must happen on server startup otherwise things won't work as expected in which case we need the service to fail. |
This should trigger the startup failure message ( |
From real life experience, it seems not - the server proceeds to load and starts waiting for requests. I even tested this with a simple "raise Exception()" scenario and it behaved the same way. |
The ASGI app should change that Exception into the failed message - which one are you using? |
I am using Quart Trio with hypercorn |
bfb0877 should fix this, will be in next patch release. |
Awesome, thanks! |
Without this, a failure that's triggered during the startup phase does not prompt aborting of the startup process and the server proceeds to finish loading and wait for incoming requests.