kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #657 from bugout-dev/add-pre-ping
Add pool pre ping parameter.pull/658/head moonstreamdb/v0.3.2
commit
4ac5b9e716
|
@ -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
|
# Pooling: https://docs.sqlalchemy.org/en/14/core/pooling.html#sqlalchemy.pool.QueuePool
|
||||||
# Statement timeout: https://stackoverflow.com/a/44936982
|
# Statement timeout: https://stackoverflow.com/a/44936982
|
||||||
return create_engine(
|
return create_engine(
|
||||||
url=url,
|
url=url,
|
||||||
|
pool_pre_ping=pool_pre_ping,
|
||||||
pool_size=pool_size,
|
pool_size=pool_size,
|
||||||
connect_args={"options": f"-c statement_timeout={statement_timeout}"},
|
connect_args={"options": f"-c statement_timeout={statement_timeout}"},
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
Moonstream database version.
|
Moonstream database version.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MOONSTREAMDB_VERSION = "0.3.1"
|
MOONSTREAMDB_VERSION = "0.3.2"
|
||||||
|
|
Ładowanie…
Reference in New Issue