Skip to content

fix: keep in-flight downloads out of cleanup - #26

Merged
isthatpratham merged 1 commit into
mainfrom
fix/cleanup-inflight-download-race
Aug 30, 2026
Merged

fix: keep in-flight downloads out of cleanup#26
isthatpratham merged 1 commit into
mainfrom
fix/cleanup-inflight-download-race

Conversation

@isthatpratham

Copy link
Copy Markdown
Owner

Summary

  • Add last_download_at (migrated on existing databases) and stamp it when a download slot is reserved
  • Cleanup skips rows reserved in the last 5 minutes so an in-flight sendFile is not unlinked
  • Missing stored files return 410 and remove the database row instead of 500
  • Legacy exhausted rows with a null stamp still clean up as before

Testing

  • npm test — 83 tests passed
  • npm run build succeeded

…as gone

Record last_download_at on reservation so cleanup cannot unlink a file mid-send. A stored file that is already gone now returns 410 and drops the database row instead of a 500.
@isthatpratham
isthatpratham merged commit 685aa11 into main Aug 30, 2026
1 check passed
@isthatpratham
isthatpratham deleted the fix/cleanup-inflight-download-race branch August 30, 2026 23:43
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.

1 participant