修改数据库8小时未使用,连接关闭的问题

This commit is contained in:
wcq 2023-04-10 11:08:01 +08:00
parent 973e88a5ef
commit 8c145a512a
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ class SqlalchemyConnect:
def init_engine(self):
engine = create_engine(
f"mysql+pymysql://{self.user}:{self.password}@{self.host}/{self.db}?charset=utf8mb4")
f"mysql+pymysql://{self.user}:{self.password}@{self.host}/{self.db}?charset=utf8mb4",pool_recycle=3600*4)
return engine
def get_db(self) -> sessionmaker: