Implement SQLAlchemy Pool.pre_ping

Fixes #241
This commit is contained in:
Keith Edmunds 2024-05-04 20:35:14 +01:00
parent 9fb7cce82c
commit 253550b490
2 changed files with 2 additions and 1 deletions

View File

@ -39,6 +39,7 @@ class Config(object):
DEFAULT_COLUMN_WIDTH = 200
DISPLAY_SQL = False
EPOCH = dt.datetime(1970, 1, 1)
ENGINE_OPTIONS = dict(pool_pre_ping=True)
ERRORS_FROM = ["noreply@midnighthax.com"]
ERRORS_TO = ["kae@midnighthax.com"]
FADE_CURVE_BACKGROUND = "lightyellow"

View File

@ -33,7 +33,7 @@ if ALCHEMICAL_DATABASE_URI is None:
raise ValueError("ALCHEMICAL_DATABASE_URI is undefined")
if "unittest" in sys.modules and "sqlite" not in ALCHEMICAL_DATABASE_URI:
raise ValueError("Unit tests running on non-Sqlite database")
db = Alchemical(ALCHEMICAL_DATABASE_URI)
db = Alchemical(ALCHEMICAL_DATABASE_URI, engine_options=Config.ENGINE_OPTIONS)
# Database classes