Skip to content

feat(server): add PostgreSQL-backed readiness probe - #363

Merged
BaaRai merged 1 commit into
BaaRai:mainfrom
chetanvhsk-wq:chetanvhsk-wq-postgres-readiness-probe
Nov 19, 2026
Merged

BaaRai merged 1 commit into
BaaRai:mainfrom
chetanvhsk-wq:chetanvhsk-wq-postgres-readiness-probe

Conversation

@chetanvhsk-wq

Copy link
Copy Markdown
Contributor

Closes #326

Adds an unauthenticated GET /api/ready probe that pings PostgreSQL with a one-second timeout and returns only {"ready":true} (200) or {"ready":false} (503). It leaves /api/health unchanged and does not run application work.

The result is cached for one second and concurrent requests share one in-flight ping. A canceled waiting request returns promptly without canceling the shared probe.

Tests cover healthy readiness, outage and recovery, error redaction, timeout, closed database, concurrent deduplication, waiter cancellation, routing/auth behavior, and unchanged liveness behavior.

Validation: go test ./server -count=1, go test -race ./server -run '^TestReady' -count=1, and go vet ./server all pass.

Note: #360 is also open for this issue; this PR is an independent implementation with expanded focused coverage.

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cached one-second ping with a single in-flight request, one-second timeout, no error details in the body, and tests for outage, recovery, closed database, timeout and a canceled waiter. CI green.

@BaaRai
BaaRai merged commit c2ddd1c into BaaRai:main Nov 19, 2026
6 checks passed
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.

Add a separate PostgreSQL-backed readiness probe

2 participants