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
I don't think we've been explicit yet as to what the planned future state is for lifespan and on_startup / on_shutdown. We currently have two mutually exclusive ways to do things, which is confusing for users and adds complexity to our codebase.
Using async context managers is (as far as I can tell) never worse than on_startup / on_shutdown and makes some use cases much easier (if you need to wrap another context manager like httpx.AsyncClient). Also as discussed in fastapi/fastapi#617 using on_startup / on_shutdown has some serious foot guns.
Given that using async context managers are all around better, I propose we get rid of on_startup and on_shutdown for 1.0.
Background:
I don't think we've been explicit yet as to what the planned future state is for lifespan and on_startup / on_shutdown. We currently have two mutually exclusive ways to do things, which is confusing for users and adds complexity to our codebase.
Using async context managers is (as far as I can tell) never worse than on_startup / on_shutdown and makes some use cases much easier (if you need to wrap another context manager like
httpx.AsyncClient
). Also as discussed in fastapi/fastapi#617 using on_startup / on_shutdown has some serious foot guns.Given that using async context managers are all around better, I propose we get rid of on_startup and on_shutdown for 1.0.
What do other think?
cc @graingert @tomchristie @Kludex
The text was updated successfully, but these errors were encountered: