Skip to content

Add /admin/scheduler/pause endpoint to freeze new booking-intent creation during incidents #584

Description

@thlpkee20-wq

Description

Add an admin-only POST /admin/scheduler/pause and /resume pair, backed by a Redis flag, that freezes new booking-intent creation platform-wide during incidents while leaving read paths intact.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/routes/admin/scheduler.ts, src/middleware/schedulerGate.ts, src/redis.ts
  • Emit scheduler_pause_total and scheduler_resume_total counters

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feat/scheduler-pause
  • Implement changes
    • Store scheduler:paused=1 in Redis with a reason and initiated_by
    • Guard the booking-intent create route with a schedulerGate middleware
    • Broadcast paused status via the existing WebSocket bus
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • npm test
  • Cover edge cases
    • Redis unavailable at guard time (fail-open with warning), pause then immediate resume, unauthorized caller
  • Include test output and notes

Example commit message

feat: scheduler pause/resume with Redis flag

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions