fix(download): resume state warnings, cancel on failure, zero-size SplitChunks #165
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/pget!165
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/fix-bugs-143-138-128-140-131"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes 3 issues, closes 2 already-done ones. All in one PR.
#143 — SaveResumeState failures silently lost
_ = SaveResumeState(...)now logs a warning on error. Download continues,but the user gets visibility if resume state can't be saved.
#140 — Workers keep running after first failure
Added
context.WithCancel(ctx)wrapping. When the first chunk error isreceived,
cancel()is called — in-flight workers abort immediatelyinstead of exhausting retries.
#131 — SplitChunks produces invalid Range for zero-size files
SplitChunks(0, n)now returnsnil. Download() checks for emptychunks and returns early (no-op for zero-size files).
#138 / #128 — Already handled
fixed by the
fullDownload=truepath usingio.Copy(reads to EOF)Testing
go test -race ./...— all pass, no racesgolangci-lint run— 0 issuesgo build ./...,go vet ./...— all cleanBreaking Changes
None
Closes #143, #140, #131, #138, #128
Review: APPROVED
Verification
go vet ./...— ✅ passesgo build ./...— ✅ passesgo test -race ./...— ✅ all passFixes applied
SaveResumeStateerrors now log a warning instead of silent discardcontext.WithCancelwrapping;cancel()called on first chunk errorSplitChunks(fileSize<=0)returns nil;Download()checks for empty chunks and exits cleanlyCloses #128, #131, #138, #140, #143 on merge.