-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switching background tasks for threads on client and server updates (#…
…122) While I was testing the app this week, I realized FastAPI's Background Tasks, which we use for client and server metric updates, are not really suitable for long running tasks as they are executed serially instead of in parallel. Here I am switching from that to plain python threads, and also making a few other changes: Adding a database connection in the listeners as FastAPI's db instance cannot be shared between threads Changing the listener functions to be async Converting the sync database functions to async in the Job Getting rid of the sync database connection, we don't need it anymore For metrics reporter, avoid saving the metrics if it's exactly the same as what's already stored. This will eliminate an issue with updates that are too frequent into Redis with no new information, which makes the app do a lot of unnecessary work. Fixing the metrics in the UI progress section for the updated metric names
- Loading branch information
Showing
13 changed files
with
320 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Database configuration parameters.""" | ||
|
||
MONGODB_URI = "mongodb://localhost:27017/" | ||
DATABASE_NAME = "florist-server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.