/ready Readiness Endpoint #81

Open
opened 2026-02-23 10:07:48 +00:00 by ottomata · 0 comments
Owner

Tasks

  • Add GET /ready endpoint to internal/api/handlers/health.go
  • Perform the following checks:
    1. Database: run SELECT 1 with a 2s timeout — fail if error
    2. Scheduler: expose a scheduler.IsRunning() bool method — fail if not running
    3. Worker Pool: expose a pool.IsHealthy() bool method — fail if pool is shut down
  • Response when all checks pass:
    { "status": "ready", "checks": { "database": "ok", "scheduler": "ok", "worker_pool": "ok" } }
    
    HTTP 200 OK
  • Response when any check fails:
    { "status": "not_ready", "checks": { "database": "error: connection refused", "scheduler": "ok", "worker_pool": "ok" } }
    
    HTTP 503 Service Unavailable
  • /ready is a public endpoint (no auth required)

Acceptance Criteria

  • /ready returns 200 when all components are healthy
  • /ready returns 503 when the DB is down
  • /ready returns 503 when the scheduler is stopped
  • /ready is usable as a Docker health check and Kubernetes readiness probe
### Tasks - [ ] Add `GET /ready` endpoint to `internal/api/handlers/health.go` - [ ] Perform the following checks: 1. **Database**: run `SELECT 1` with a 2s timeout — fail if error 2. **Scheduler**: expose a `scheduler.IsRunning() bool` method — fail if not running 3. **Worker Pool**: expose a `pool.IsHealthy() bool` method — fail if pool is shut down - [ ] Response when all checks pass: ```json { "status": "ready", "checks": { "database": "ok", "scheduler": "ok", "worker_pool": "ok" } } ``` HTTP `200 OK` - [ ] Response when any check fails: ```json { "status": "not_ready", "checks": { "database": "error: connection refused", "scheduler": "ok", "worker_pool": "ok" } } ``` HTTP `503 Service Unavailable` - [ ] `/ready` is a public endpoint (no auth required) ### Acceptance Criteria - [ ] `/ready` returns `200` when all components are healthy - [ ] `/ready` returns `503` when the DB is down - [ ] `/ready` returns `503` when the scheduler is stopped - [ ] `/ready` is usable as a Docker health check and Kubernetes readiness probe
ottomata added this to the Phase 8 project 2026-02-23 10:09:19 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ottomata/acsm#81
No description provided.