Skip to content

Feature/process shutdown hygiene#174

Merged
greatest0fallt1me merged 3 commits intoCalloraOrg:mainfrom
Mkalbani:feature/process-shutdown-hygiene
Mar 27, 2026
Merged

Feature/process shutdown hygiene#174
greatest0fallt1me merged 3 commits intoCalloraOrg:mainfrom
Mkalbani:feature/process-shutdown-hygiene

Conversation

@Mkalbani
Copy link
Copy Markdown
Contributor

closes #144

Summary

Adds graceful process shutdown hygiene for production while keeping local dev watch behavior intact.

What Changed

  • Added SIGTERM and SIGINT shutdown hooks with one-time registration.
  • Implemented an idempotent graceful shutdown flow to prevent duplicate teardown.
  • Stopped accepting new HTTP requests before shutdown completes.
  • Added timeout handling for lingering in-flight connections.
  • Closed DB resources during shutdown where applicable (SQLite, PostgreSQL pool, Prisma disconnect).
  • Documented production shutdown expectations in README.
  • Added minimal tests for graceful shutdown behavior and repeated-signal edge case.

Testing

  • npm run lint: pass (warnings only, no new lint errors from this change)
  • npm run typecheck: blocked by pre-existing repo issues unrelated to this PR
  • npm test: pre-existing failures remain unrelated to this PR
  • Focused verification: npx jest index.test.ts --runInBand (passed)

Security / Data Integrity Notes

  • Reduces risk of dropped or partial in-flight work during termination.
  • Ensures predictable single-run teardown under repeated signals.
  • Prevents hung shutdowns by enforcing connection timeout handling.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@Mkalbani Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me greatest0fallt1me merged commit d6ec641 into CalloraOrg:main Mar 27, 2026
1 check failed
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.

Index bootstrap: index.ts startup/shutdown hygiene

2 participants