Improving performance auto-reload of FastAPI app with lifespan events #1887
Unanswered
havardthom
asked this question in
Q&A
Replies: 1 comment
-
|
https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html#autoreload existence proof of the concept. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm running a FastAPI app using uvicorn with auto-reload and it takes quite some time for the app to run shutdown event and startup event on every auto-reload. Does anyone have any tips/tricks regarding speeding up auto-reload of a FastAPI app?
Ideally, it would be great with an option where lifespan events only run on first startup and shutdown and does not need to run on every auto-reload. In my case the startup event does a lot of service initializations and assigns to
app.state(because factory pattern), so somehow cachingapp.statewould alleviate a lot, but that is very specific to my usecase.Beta Was this translation helpful? Give feedback.
All reactions