feat: a database connection pool behind DB_POOL (off in production)
Every db.connect() opened a new Postgres connection; with DB_POOL=on each process keeps a psycopg_pool pool (DB_POOL_SIZE, default 20, 10 s acquisition timeout, dropped connections replaced) with the same commit/rollback contract. Production stays off until switched in Portainer; the local stack and CI run with it on. Two nested acquisitions that ran on every board load and in audits now reuse the caller's connection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,10 @@ x-app-environment: &app-environment
|
||||
# Must differ from POSTGRES_PASSWORD: the runtime role is DML-only, and reusing
|
||||
# the administrator credential would make that restriction meaningless.
|
||||
DATABASE_PASSWORD: ${APP_DB_PASSWORD:?set APP_DB_PASSWORD}
|
||||
# Reuse database connections per API/worker process when on; off keeps one
|
||||
# connection per `with` block, exactly as before (the production default).
|
||||
DB_POOL: ${DB_POOL:-off}
|
||||
DB_POOL_SIZE: ${DB_POOL_SIZE:-20}
|
||||
S3_ENDPOINT: ${R2_ENDPOINT:?set R2_ENDPOINT}
|
||||
S3_PUBLIC_ENDPOINT: ${R2_ENDPOINT:?set R2_ENDPOINT}
|
||||
S3_BUCKET: ${R2_BUCKET:?set R2_BUCKET}
|
||||
|
||||
Reference in New Issue
Block a user