Skip to content

feat: add graceful shutdown drain for /api/exports - #709

Open
Tonyfash wants to merge 1 commit into
Predictify-org:mainfrom
Tonyfash:issue-612-exports-drain
Open

feat: add graceful shutdown drain for /api/exports#709
Tonyfash wants to merge 1 commit into
Predictify-org:mainfrom
Tonyfash:issue-612-exports-drain

Conversation

@Tonyfash

Copy link
Copy Markdown

This PR adds a graceful shutdown drain for /api/exports routes (Closes #612). On SIGTERM/SIGINT, in-flight export requests are allowed to finish before the server exits.

Changes:

  • src/routes/exports.ts: Added in-flight request tracking with inFlightExportsRequests counter, exportsInFlightMiddleware using res.once('finish'/'close') cleanup (matching the pattern from auth.ts), and drainExportsRequests function
  • src/server.ts: Imported and called drainExportsRequests(4000) during shutdown alongside the existing search drain

Add in-flight request tracking and drain mechanism for /api/exports
routes, following the same pattern used by /api/search and /api/auth.
The SIGTERM handler in server.ts now waits for exports requests to
complete before exiting.

Closes Predictify-org#612
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Tonyfash 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

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/exports [b#038]

1 participant