You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ASGI includes a lifespan messaging channel, which provides startup and shutdown events.
This also means there's a managed context within which we can hook timer events.
Please don't close this yet. The startup one is kinda essential to be honest if you want to perform async setup, like creating a dbpool:
This is due to the event loop not being created before after you've run api.run(), which then blocks.
You could pass your own loop instance as an option into api.run() which would then be passed into uvicorn to use, but it isn't pretty nor pythonic.
ASGI includes a
lifespan
messaging channel, which provides startup and shutdown events.This also means there's a managed context within which we can hook timer events.
Interfaces for this might look something like...
These would be a nice easy win that ASGI gives us which WSGI isn't able to.
Starlette currently supports startup and shutdown events, so that's a good first place to look for implementation... https://www.starlette.io/events/
The text was updated successfully, but these errors were encountered: