From 27129a80a333ef931457c99d52c868ac19472890 Mon Sep 17 00:00:00 2001 From: xhy Date: Sat, 5 Apr 2025 16:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=20MySQL=20?= =?UTF-8?q?Server=20gone=20away=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/base.py b/app/models/base.py index 8e9cb11..8721636 100644 --- a/app/models/base.py +++ b/app/models/base.py @@ -35,7 +35,7 @@ def connect_db(config: AppConfig): from .report_urls import ReportUrlModel dsn = f"mysql+pymysql://{config.database.user}:{config.database.password}@{config.database.host}:{config.database.port}/{config.database.database}" - engine = create_engine(dsn, echo=False) + engine = create_engine(dsn, echo=False, pool_size=4, max_overflow=10, pool_recycle=60, pool_pre_ping=True) SQLModel.metadata.create_all(engine) AppCtx.g_db_engine = engine