-
Should we change the docs to recommend using the newly added lifespan state instead of app.state? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Is it supported by any ASGI servers besides the very latest version (i.e: released yesterday) version of Uvicorn? That's going to be a caveat to reccomending it until support for this can be more or less assumed. As for replacing def open_database_connection_pools(app: Starlette):
app.state.db_pool = ...
def close_database_connection_pools(app: Starlette):
app.state.db_pool.dispose()
app = Starlette()
app.add_event_handler('startup', partial(open_database_connection_pools, app))
app.add_event_handler('shutdown', partial(close_database_connection_pools, app)) So nevermind that part about |
Beta Was this translation helpful? Give feedback.
-
Is your suggestion to deprecate app.state? |
Beta Was this translation helpful? Give feedback.
-
Please, please, avoid deprecating useful features when there is no major benefit to deprecation! Every deprecation burns out current adopters of Starlette, who took a gamble on Starlette, who then are stuck with:
Just because your current project does not use a specific feature, doesn't mean it should be deleted from Starlette. I can't believe these deprecation proposals keep happening. |
Beta Was this translation helpful? Give feedback.
-
As we talked at some point, we are not deprecating |
Beta Was this translation helpful? Give feedback.
As we talked at some point, we are not deprecating
app.state
, but lifespan state is recommended.