Skip to content

fix: add graceful shutdown drain for /api/keys - #1039

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
chiscookeke11:fix/943-graceful-shutdown-api-keys
Jul 29, 2026
Merged

fix: add graceful shutdown drain for /api/keys#1039
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
chiscookeke11:fix/943-graceful-shutdown-api-keys

Conversation

@chiscookeke11

@chiscookeke11 chiscookeke11 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a graceful shutdown drain handler for /api/keys\ requests upon receiving SIGTERM or SIGINT signals.

Closes #943

Details of Changes

  • Integrated \keysDrainTracker\ (\createInFlightDrainTracker('api-keys')) to monitor active /api/keys\ requests.
  • Added subsystem shutdown tracking so in-flight requests finish before server exit.
  • Configured incoming requests during server drain phase to receive \Connection: close\ headers.
  • Verified zero regressions with unit tests covering shutdown drain behavior.

Verification

Ran
px jest src/lifecycle/shutdown.test.ts\ to confirm all 21 shutdown tests pass successfully:

  • Active /api/keys\ requests finish before process exit.
  • \Connection: close\ header set on new requests arriving during drain phase.

@greatest0fallt1me
greatest0fallt1me merged commit 4b3d01b into CalloraOrg:main Jul 29, 2026
1 check passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Green ✅ merging. Thanks for the contribution!

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 graceful shutdown drain for /api/keys [b#078]

2 participants