Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

fix(server)!: fix reloading config #231

Merged
merged 3 commits into from
Jan 12, 2023
Merged

fix(server)!: fix reloading config #231

merged 3 commits into from
Jan 12, 2023

Conversation

peterschutt
Copy link
Member

This pr moves the database/cache readiness checks into the starlite before_startup hook, which removes our need to use the event loop before we startup the application.

This means we can let starlette manage the event loop for us, taking away the need to do a lot of dancing around the fact that starlette assume they should be managing the event loop.

Adds automatic entry into reloading mode if environment is set to "local".

gazorby and others added 3 commits January 12, 2023 07:42
Logic for reloading is in `uvicorn.run()`, but to use it we need to let
uvicorn manage the event loop for us.

So this commit moves the database/cache readiness checks into a
starlite, "before_startup" hook handler, so that they are conducted
after uvicorn has setup the event loop.
@peterschutt peterschutt merged commit ed2fe59 into 0.25 Jan 12, 2023
@peterschutt peterschutt deleted the feat/auto-reload branch January 12, 2023 00:50
peterschutt added a commit that referenced this pull request Jan 12, 2023
* ✨ feat(scripts): auto reload when ENVIRONMENT==local

* 🐛 fix: typing and docs

* fix(reloading): use `uvicorn.run()`

Logic for reloading is in `uvicorn.run()`, but to use it we need to let
uvicorn manage the event loop for us.

So this commit moves the database/cache readiness checks into a
starlite, "before_startup" hook handler, so that they are conducted
after uvicorn has setup the event loop.

Co-authored-by: gazorby <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants