mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 09:17:06 +08:00
refactor: Increase database connection pool
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
from sqlmodel import Session, create_engine, SQLModel
|
||||
|
||||
|
||||
from common.core.config import settings
|
||||
|
||||
engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI), pool_size=20, max_overflow=30, pool_recycle=3600,
|
||||
pool_pre_ping=True)
|
||||
|
||||
engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
|
||||
|
||||
def get_session():
|
||||
with Session(engine) as session:
|
||||
yield session
|
||||
|
||||
|
||||
def init_db():
|
||||
SQLModel.metadata.create_all(engine)
|
||||
|
||||
Reference in New Issue
Block a user