Skip to content

feat: add graceful shutdown drain for /api/fingerprint - #870

Open
devv-leo wants to merge 1 commit into
Predictify-org:mainfrom
devv-leo:fix/fingerprint-graceful-drain
Open

feat: add graceful shutdown drain for /api/fingerprint#870
devv-leo wants to merge 1 commit into
Predictify-org:mainfrom
devv-leo:fix/fingerprint-graceful-drain

Conversation

@devv-leo

Copy link
Copy Markdown

Closes #592

Summary

Adds a graceful shutdown drain for /api/fingerprint requests to the SIGTERM/SIGINT handler.

Changes

  • src/routes/fingerprint.ts — Added inFlightFingerprintRequests counter with try/finally in route handler; exported drainFingerprintRequests() function following the same pattern as search and exports drains
  • src/server.ts — Imported and wired drainFingerprintRequests(4000) into the server shutdown handler alongside existing search/exports drains
  • tests/fingerprint.test.ts — Added drain test verifying immediate return when no in-flight requests
  • src/routes/users.ts — Fixed corrupted merge from upstream that broke the test suite

Verification

  • Fingerprint tests: 48 pass, 2 pre-existing failures (unrelated to this change)
  • Implementation follows identical patterns to drainSearchRequests and drainExportsRequests

Implements a SIGTERM handler that lets in-flight /api/fingerprint requests finish before exit.

- Add inFlightFingerprintRequests counter with try/finally in route handler
- Export drainFingerprintRequests() following the same pattern as search/exports
- Wire drainFingerprintRequests(4000) into the server shutdown handler
- Add drain test to tests/fingerprint.test.ts
- Fix corrupted users.ts merge from upstream

Closes Predictify-org#592
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@devv-leo 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/fingerprint [b#018]

1 participant