From 928c683057309a7cd8f1a3bed1e994ec803741fa Mon Sep 17 00:00:00 2001 From: Brian Brondel Date: Tue, 19 Nov 2024 11:19:35 -0300 Subject: [PATCH] Use pool_pre_ping in pqserver to replace stale connections --- python/lsst/consdb/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/consdb/utils.py b/python/lsst/consdb/utils.py index 47cab928..21b9e382 100644 --- a/python/lsst/consdb/utils.py +++ b/python/lsst/consdb/utils.py @@ -57,7 +57,7 @@ def setup_postgres() -> sqlalchemy.Engine: else: pg_url = os.environ["POSTGRES_URL"] logger.info(f"Using POSTGRES_URL {pg_url}") - engine = sqlalchemy.create_engine(pg_url, pool_recycle=3600) + engine = sqlalchemy.create_engine(pg_url, pool_recycle=3600, pool_pre_ping=True) if pg_url.startswith("sqlite:///"): # For unit tests start_pos = len("sqlite:///")