diff --git a/db/moonstreamdb/db.py b/db/moonstreamdb/db.py index 1fe07d4f..199e21f8 100644 --- a/db/moonstreamdb/db.py +++ b/db/moonstreamdb/db.py @@ -39,11 +39,14 @@ except: ) -def create_moonstream_engine(url: str, pool_size: int, statement_timeout: int): +def create_moonstream_engine( + url: str, pool_size: int, statement_timeout: int, pool_pre_ping: bool = False +): # Pooling: https://docs.sqlalchemy.org/en/14/core/pooling.html#sqlalchemy.pool.QueuePool # Statement timeout: https://stackoverflow.com/a/44936982 return create_engine( url=url, + pool_pre_ping=pool_pre_ping, pool_size=pool_size, connect_args={"options": f"-c statement_timeout={statement_timeout}"}, ) diff --git a/db/moonstreamdb/version.py b/db/moonstreamdb/version.py index 0ec602cb..87b3b0d8 100644 --- a/db/moonstreamdb/version.py +++ b/db/moonstreamdb/version.py @@ -2,4 +2,4 @@ Moonstream database version. """ -MOONSTREAMDB_VERSION = "0.3.1" +MOONSTREAMDB_VERSION = "0.3.2"