📌 Description
src/db/index.ts establishes the Postgres pool at startup; if the DB isn't reachable yet (e.g. during a coordinated deploy where the DB container is still starting), the service likely fails hard instead of retrying.
🧩 Requirements and context
- Retry the initial connectivity check with exponential backoff up to a configurable max attempts/time.
- Log each retry attempt at a reasonable level (warn, not error, until attempts are exhausted).
- Fail fast with a clear error once retries are exhausted.
🛠️ Suggested execution
- Wrap the startup connectivity check in
src/db/index.ts with a retry/backoff loop.
- Make max attempts and base delay configurable via
src/config.ts.
- Add tests simulating transient connection failure followed by success, and exhausted-retries failure.
✅ Acceptance criteria
🔒 Security notes
Backoff must be bounded (max attempts/time) so a permanently-unreachable DB doesn't retry forever and mask an outage.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
src/db/index.tsestablishes the Postgres pool at startup; if the DB isn't reachable yet (e.g. during a coordinated deploy where the DB container is still starting), the service likely fails hard instead of retrying.🧩 Requirements and context
🛠️ Suggested execution
src/db/index.tswith a retry/backoff loop.src/config.ts.✅ Acceptance criteria
🔒 Security notes
Backoff must be bounded (max attempts/time) so a permanently-unreachable DB doesn't retry forever and mask an outage.
📋 Guidelines