refac
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11.x) (push) Waiting to run
Python CI / Format Backend (3.12.x) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run

This commit is contained in:
Timothy Jaeryang Baek 2025-06-21 19:12:43 +04:00
parent 38e8209d71
commit aef0ad2d10

View File

@ -84,24 +84,23 @@ if "sqlite" in SQLALCHEMY_DATABASE_URL:
SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
) )
else: else:
if DATABASE_POOL_SIZE > 0: if isinstance(DATABASE_POOL_SIZE, int):
engine = create_engine( if DATABASE_POOL_SIZE > 0:
SQLALCHEMY_DATABASE_URL, engine = create_engine(
pool_size=DATABASE_POOL_SIZE, SQLALCHEMY_DATABASE_URL,
max_overflow=DATABASE_POOL_MAX_OVERFLOW, pool_size=DATABASE_POOL_SIZE,
pool_timeout=DATABASE_POOL_TIMEOUT, max_overflow=DATABASE_POOL_MAX_OVERFLOW,
pool_recycle=DATABASE_POOL_RECYCLE, pool_timeout=DATABASE_POOL_TIMEOUT,
pool_pre_ping=True, pool_recycle=DATABASE_POOL_RECYCLE,
poolclass=QueuePool, pool_pre_ping=True,
) poolclass=QueuePool,
elif DATABASE_POOL_SIZE == 0: )
engine = create_engine( else:
SQLALCHEMY_DATABASE_URL, pool_pre_ping=True, poolclass=NullPool engine = create_engine(
) SQLALCHEMY_DATABASE_URL, pool_pre_ping=True, poolclass=NullPool
)
else: else:
engine = create_engine( engine = create_engine(SQLALCHEMY_DATABASE_URL, pool_pre_ping=True)
SQLALCHEMY_DATABASE_URL, pool_pre_ping=True
)
SessionLocal = sessionmaker( SessionLocal = sessionmaker(