Skip to content

Commit

Permalink
Add a timeout to queries
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <[email protected]>
  • Loading branch information
mattiaverga committed Jan 27, 2024
1 parent f610256 commit 34994d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bodhi-server/bodhi/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def initialize_db(config):
# The SQLAlchemy database engine. This is constructed using the value of
# ``DB_URL`` in :data:`config``. Note: A copy is provided since ``engine_from_config``
# uses ``pop``.
engine = engine_from_config(config.copy(), 'sqlalchemy.')
engine = engine_from_config(config.copy(),
'sqlalchemy.',
connect_args={'options': "-c statement_timeout=30000"})
# When using SQLite we need to make sure foreign keys are enabled:
# http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#foreign-key-support
if config['sqlalchemy.url'].startswith('sqlite:'):
Expand Down

0 comments on commit 34994d6

Please sign in to comment.