perf(db): configure database connection pools
Add configurable PostgreSQL and database/sql pool limits, validate invalid environment values, clamp idle connections, and cover the parsing/application logic with unit tests.
This commit is contained in:
@@ -79,6 +79,10 @@ services:
|
||||
- DB_USER=${DB_USER:-}
|
||||
- DB_PASSWORD=${DB_PASSWORD:-}
|
||||
- DB_NAME=${DB_NAME:-}
|
||||
- DB_MAX_OPEN_CONNS=${DB_MAX_OPEN_CONNS:-120}
|
||||
- DB_MAX_IDLE_CONNS=${DB_MAX_IDLE_CONNS:-20}
|
||||
- DB_CONN_MAX_IDLE_TIME=${DB_CONN_MAX_IDLE_TIME:-5m}
|
||||
- DB_CONN_MAX_LIFETIME=${DB_CONN_MAX_LIFETIME:-10m}
|
||||
- TZ=${TZ:-Asia/Shanghai}
|
||||
- WEKNORA_LANGUAGE=${WEKNORA_LANGUAGE:-zh-CN}
|
||||
# ========== Langfuse (optional observability) ==========
|
||||
@@ -291,6 +295,7 @@ services:
|
||||
postgres:
|
||||
image: paradedb/paradedb:v0.22.2-pg17
|
||||
container_name: WeKnora-postgres
|
||||
command: ["postgres", "-c", "max_connections=${POSTGRES_MAX_CONNECTIONS:-300}"]
|
||||
environment:
|
||||
- POSTGRES_USER=${DB_USER}
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||
|
||||
Reference in New Issue
Block a user