Skip to content

fix(downloader): keep the chunk in memory and retry the write instead of re-downloading - #75

Open
lukyrys wants to merge 5 commits into
mainfrom
fix/330-retain-chunk-on-write-retry
Open

fix(downloader): keep the chunk in memory and retry the write instead of re-downloading#75
lukyrys wants to merge 5 commits into
mainfrom
fix/330-retain-chunk-on-write-retry

Conversation

@lukyrys

@lukyrys lukyrys commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

When a chunk write fails because the disk is full or the target directory is not writable, the downloader now keeps the already-verified chunk in memory and retries the same bytes instead of dropping them and downloading the chunk again.

  • the retry runs on the existing WRITE_RETRY_DELAY interval up to MAX_WRITE_RETRIES; all other writes for that LISH stay paused meanwhile
  • a peer that hits the error while another peer already owns the pause waits for it and then retries its own retained buffer, so concurrent peers cannot burn the shared retry limit against each other
  • if the file disappears during a retry (ENOENT), the chunk goes back to the queue and the existing missing-file recovery takes over
  • the reported error code follows the live cause, so an EACCES that later turns into ENOSPC is reported correctly
  • no frontend changes

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