-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(database): limit the number of open database connections (#437)
Up until now, to avoid keeping open idle connections with the database, the connection pool was disposed after every request. However, connections that are checked out at the moment of the pool disposal are kept open, and they do not count towards the maximum number of connections set by `SQLALCHEMY_POOL_SIZE` and `SQLALCHEMY_MAX_OVERFLOW`. This resulted in many connections being open at the same time, saturating the capacity of the database. Instead of destroying the pool at each request, connections are closed each time they are put back in the pool. The end result is the same, as no idle connection is kept open for long periods of time. At the same time, the pool enforces that the number of open connections is limited, so that the database is not overwhelmed.
- Loading branch information
Showing
2 changed files
with
24 additions
and
9 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