mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-25 18:02:40 -05:00
By default, SQLAlchemy will start a transaction with an existing connection without checking that the connection is still valid. Enabling "pre-ping" makes the ORM send a `SELECT 1` when acquiring a connection, which should help avoid some errors caused by connections breaking during a DB failover. The added statement has a constant overhead for all transactions, so we should only keep it enabled when we're planning to switch or upgrade the database server. https://docs.sqlalchemy.org/en/latest/core/pooling.html#disconnect-handling-pessimistic