From 0975de123842052e4767478950545ece972fbd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Wed, 25 Oct 2023 12:26:28 +0100 Subject: [PATCH] [#717] Add a pool_recycle database engine arg to avoid losing connection with database --- src/common/db/Database.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/db/Database.py b/src/common/db/Database.py index d66ce9fe..c16209ea 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -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