Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Future of on_startup/on_shutdown and lifespan #2066

Closed
adriangb opened this issue Mar 5, 2023 · 0 comments
Closed

Future of on_startup/on_shutdown and lifespan #2066

adriangb opened this issue Mar 5, 2023 · 0 comments

Comments

@adriangb
Copy link
Member

adriangb commented Mar 5, 2023

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 tiangolo/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

@encode encode locked and limited conversation to collaborators Mar 5, 2023
@adriangb adriangb converted this issue into discussion #2067 Mar 5, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant