fix(api): cap db pool during prod rollout
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 1m46s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped

This commit is contained in:
ogt
2026-07-01 17:00:53 +08:00
parent 0f9583d47f
commit 4561c65fe9
6 changed files with 169 additions and 40 deletions

View File

@@ -273,6 +273,24 @@ class Settings(BaseSettings):
DATABASE_URL: str = Field(
description="PostgreSQL connection URL (必填,從 K8s Secret awoooi-secrets → DATABASE_URL 取得)",
)
DATABASE_POOL_SIZE: int = Field(
default=1,
ge=1,
le=10,
description="SQLAlchemy asyncpg pool size. Production DB role currently has a very small connection budget.",
)
DATABASE_MAX_OVERFLOW: int = Field(
default=0,
ge=0,
le=20,
description="Extra asyncpg connections above DATABASE_POOL_SIZE. Keep 0 in production until DB role limit is raised.",
)
DATABASE_POOL_TIMEOUT_SECONDS: float = Field(
default=5.0,
ge=1.0,
le=30.0,
description="Seconds to wait for a pooled DB connection before failing visible.",
)
# ==========================================================================
# Redis (192.168.0.188:6380, DB 0 - 與 OpenClaw 共用)