Repository navigation
fix(download): six-hour sessions, purge waits for running downloads (#31, #32) - #64
Merged
Merged
Conversation
…clear message on a dropped connection A download session lasted a fixed 15 minutes and the purge deleted a closed bundle's files a fixed 25 minutes after it closed, so anything slower broke: the encrypted Download All opened a new session (counting another download, or failing on a 1-download bundle) for files after minute 15, and a long server-built ZIP could have its files deleted mid-stream. - A session now lasts 6 hours, never past the bundle's own expiry. That covers a 5 GB bundle on a slow connection, and retrying after a dropped connection without counting another download. It is also the cap on re-downloading with one counted download. - The purge waits for a closed bundle's sessions to end (plus the lifetime of the last URL they could issue) instead of a fixed 25 minutes, so it never deletes files under a running download, and doesn't hold storage longer than needed otherwise. - A download that fails because the connection dropped now says so, and that trying again soon doesn't use up another download, instead of a technical error. Fixes #31 Fixes #32 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A download session lasted a fixed 15 minutes, and the purge deleted a closed bundle's files a fixed 25 minutes after it closed. Anything slower broke:
Agreed design (discussed before building):
1. Sessions last 6 hours, never past the bundle's expiry
DownloadTimings.SessionLifetime: 15 min → 6 h. The existing cap at the bundle'sExpiresAtstays, so expiry remains hard. This covers a 5 GB bundle on a slow connection, and retrying after a dropped connection without counting another download. It's also the cap on re-downloading with one counted download. A fixed lifetime was chosen over a renewing one: the renewing version gave no extra protection (a holder could renew up to the cap anyway), needed keep-alive requests, and failed exactly when a connection dropped for more than 15 minutes.2. The purge waits for running downloads
Before, it waited a fixed 25 minutes after the bundle closed. Now it skips a closed bundle while any of its sessions is still active, or ended less than
StorageDeletionGracePeriod(= URL lifetime + 5 min) ago. That grace is also all it waits after closing, so storage isn't held longer than needed when nothing is downloading.3. A clear message when the connection drops
"The connection was lost while downloading. Click Download again: trying again within the next few hours doesn't use up another of this bundle's downloads." This replaces a technical error.
isConnectionLostrecognises browsers' fetch/stream network errors (Chrome, Firefox, Safari wording) and API calls that got no response, but not tampering, programming errors or server answers.Test plan
openDownloadSessioncalled once)isConnectionLostfor each browser's wording, and not for tampering,TypeErrors from bugs, server answers, or cancelled requestsdotnet test55 unit + 135 integration;vitest189;tsc -b,eslintcleanFixes #31
Fixes #32
🤖 Generated with Claude Code