Improving performance auto-reload of FastAPI app with lifespan events #1887
Unanswered
havardthom
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.state
would alleviate a lot, but that is very specific to my usecase.Beta Was this translation helpful? Give feedback.
All reactions