尝试修复 MySQL Server gone away 问题
This commit is contained in:
parent
65de166821
commit
27129a80a3
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user