Skip to content

Commit 9e5ce45

Browse files
committed
Pre-pinging the database to check the aliveness of the connection | Related to #27
1 parent bc98972 commit 9e5ce45

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tg_bot/modules/sql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def start() -> scoped_session:
9-
engine = create_engine(DB_URI, client_encoding="utf8")
9+
engine = create_engine(DB_URI, client_encoding="utf8", pool_pre_ping=True)
1010
BASE.metadata.bind = engine
1111
BASE.metadata.create_all(engine)
1212
return scoped_session(sessionmaker(bind=engine, autoflush=False))

0 commit comments

Comments
 (0)