Repository navigation
feat(core): retry a failed connection's own range instead of the whole batch - #596
Conversation
…e batch A connection that fails with a retryable KetchError other than a 429 releases its lane (SegmentLedger.release) and waits RetryPolicy's delay while the other connections keep running. The next connection to finish takes the released bytes whole; the failed one then rejoins its own lane, or splits another's when it was taken, and stops waiting early once a connection ended for lack of work. Its retries count from zero after a transfer that wrote bytes. The batch still fails, for DownloadExecution to retry the run, when a connection runs out of retries, the error is not retryable, it is a 429 (so HttpDownloadSource lowers the connections), or no other connection is transferring.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1147d69ad9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…' ranges A connection that received nothing in its last measured lane already takes over no tail and closes. It now leaves a released range alone too, so the bytes wait for their own connection to retry instead of going whole to a stalled one.
…s lane A connection could take the released bytes, finish them and end before the failed one read the count, which then waited out its whole retry delay with nothing left to do. The wait now starts from the count before the release, and ends early only once the lane was taken, so a connection ending while the lane is still free never skips the backoff.
Summary
A connection that fails with a retryable
KetchError(other than a 429) no longer cancels the whole segmented batch:SegmentLedger.release) and waitsRetryPolicy.delayMswhile the other connections keep running.rejoins: it takes its own lane back if nobody took it, otherwise it splits another lane's tail like a finished connection, or it ends. It stops waiting early once another connection ended for lack of work.The batch still fails, and
DownloadExecutionretries the run from saved segments, when:retryCount;HttpDownloadSourcelowers the connections;This applies to HTTP, FTP, WebDAV and Metalink mirrors, which all go through
SegmentedDownloadHelper, and only with range support. It covers the first part of roadmap item 3 (Lane scheduler).Tests
SegmentedDownloadHelperTestcases cover: a failed range retried alone while the others keep running, a finished connection taking a failed one's bytes, retries running out, retries counted again after progress, 429, non-retryable errors, every connection failing, and no range support (the batch fails)../gradlew :library:core:jvmTest :library:ftp:jvmTest :library:webdav:jvmTest :library:metalink:jvmTestpasses.