perf(SKY-8227): re-add DB pool timeout/recycle knobs and API-only pool sizing (#7159)

This commit is contained in:
Aaron Perez 2026-07-07 13:16:38 -05:00 committed by GitHub
parent f920d193eb
commit f939ec8d32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 48 additions and 0 deletions

View file

@ -155,6 +155,11 @@ class Settings(BaseSettings):
DISABLE_CONNECTION_POOL: bool = False
DATABASE_POOL_SIZE: int = 5
DATABASE_POOL_MAX_OVERFLOW: int = 10
# Timeout/recycle defaults mirror SQLAlchemy's QueuePool. Size pools per service
# via env vars: raising defaults here multiplies across every engine and replica
# and can exhaust pgbouncer client connections.
DATABASE_POOL_TIMEOUT: int = 30
DATABASE_POOL_RECYCLE: int = -1
PROMPT_ACTION_HISTORY_WINDOW: int = 1
TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3

View file

@ -348,6 +348,8 @@ def _build_engine(database_string: str) -> AsyncEngine:
pool_pre_ping=True,
pool_size=settings.DATABASE_POOL_SIZE,
max_overflow=settings.DATABASE_POOL_MAX_OVERFLOW,
pool_timeout=settings.DATABASE_POOL_TIMEOUT,
pool_recycle=settings.DATABASE_POOL_RECYCLE,
)