mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
[#717] Add a pool_recycle database engine arg to avoid losing connection with database
This commit is contained in:
parent
762092e5e9
commit
0975de1238
1 changed files with 1 additions and 2 deletions
|
@ -88,7 +88,7 @@ class Database:
|
|||
self.database_uri = sqlalchemy_string
|
||||
error = False
|
||||
|
||||
engine_kwargs = {"future": True, "poolclass": None if pool else SingletonThreadPool, "pool_pre_ping": True}
|
||||
engine_kwargs = {"future": True, "poolclass": None if pool else SingletonThreadPool, "pool_pre_ping": True, "pool_recycle": 1800}
|
||||
|
||||
try:
|
||||
self.__sql_engine = create_engine(sqlalchemy_string, **engine_kwargs)
|
||||
|
@ -169,7 +169,6 @@ class Database:
|
|||
_exit(1)
|
||||
|
||||
session = self.__sql_session()
|
||||
session.expire_on_commit = False
|
||||
|
||||
try:
|
||||
yield session
|
||||
|
|
Loading…
Reference in a new issue