Skip to content

fix: wire DB pool sizing via env (DATABASE_POOL_MIN/MAX, timeouts)#583

Open
snowrugar-beep wants to merge 1 commit into
Gatheraa:mainfrom
snowrugar-beep:fix/issue-526-db-pool-env-config
Open

fix: wire DB pool sizing via env (DATABASE_POOL_MIN/MAX, timeouts)#583
snowrugar-beep wants to merge 1 commit into
Gatheraa:mainfrom
snowrugar-beep:fix/issue-526-db-pool-env-config

Conversation

@snowrugar-beep

Copy link
Copy Markdown
Contributor

Summary

DB pool size, idle timeout, statement timeout, and max lifetime were hardcoded. Staging and production could not be tuned without a code change, causing cold-start failures under load.

Changes

  • app/backend/src/app.module.ts: switch TypeOrmModule.forRoot to forRootAsync, inject ConfigService, and pass DATABASE_POOL_MIN, DATABASE_POOL_MAX, IDLE_TIMEOUT_MS, STATEMENT_TIMEOUT_MS, MAX_LIFETIME_MS from env with safe defaults.
  • app/backend/.env.example: document all five new env vars with default values and comments.

Testing

  • Set DATABASE_POOL_MAX=2 and send concurrent requests beyond the pool — server returns 503 (pool saturation), not a 500 crash.
  • Default values keep existing unit tests green.

Closes #526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[backend][ops] No graceful DB pool sizing / env-driven configuration

1 participant