You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decorate only Flavor.get_* methods that execute queries
The get_* methods on the Flavor object use a common helper method to
build a query object to execute later.
Currently, the @api_db_api.context_manager.reader decorator which
manages the session is located on the helper method instead of on the
methods that actually execute the database queries. Part of the context
manager's job is to close the session after the query is executed.
Because the decorator is not on the methods that actually execute the
queries, those database connections are not being closed and it will
eventually lead to errors like:
sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 50
reached, connection timed out, timeout 30.00 (Background on this
error at: https://sqlalche.me/e/14/3o7r)
which means the connection pool size plus the overflow size has been
reached and the pool will block for a fixed period of time before
timing out and raising this error.
This removes the @api_db_api.context_manager.reader decorator from the
query build helper method and adds it to the Flavor.get_* methods that
execute the database queries.
Closes-Bug: #2027755
Change-Id: I4bf83d1642b62ab103716aff6dae7438646e2b31
(cherry picked from commit 9ae6240)
0 commit comments