feat(gallery/downloader): Implement Advanced Download Management System (Pause/Resume, Auto-Resume, Sidecar, and Throttling)#10478
Open
aslamalkarywk7 wants to merge 1 commit into
Conversation
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.
Description
This PR introduces a comprehensive, production-grade Download Management System for the model gallery downloader. It replaces the previous aggressive clean-up behavior (which deleted
.partialfiles upon any cancellation) with an explicit pause/resume architecture, and layers four robust capabilities on top:/api/operations/pause-alland/api/operations/resume-all) to pause or resume all active gallery operations concurrently..partial.json): Safely marshals download state (original URL, timestamp, model ID) into a sidecar descriptor file when paused, protecting progress against application crashes or manual restarts.Start()), parses orphaned sidecar metadata, and auto-queues interrupted downloads using native HTTP Range headers.io.Readerwrapper, exposing a configurable API (/api/operations/:jobID/throttle?rate=2mb) supporting kb/mb/gb human-readable formats.This PR fixes # (Leave blank or insert issue number if applicable)
Notes for Reviewers
context.WithCancelCause) viadownloader.ErrUserPaused. This ensures that explicit pauses skip the asset erasure wrapper (removePartialFile), while traditional user cancels (ErrUserCancelled) maintain backward-compatible cleanup behaviors.pkg/downloader/sidecar.goandpkg/downloader/ratelimit.go) to adhere strictly to separation of concerns and maintain a cleanuri.go.os.Renamecollisions) that historically fail standardcancel_test.gosuites under NTFS remain downstream constraints. The underlying core logic has been tested cleanly and runs natively out-of-the-box on standard Linux/Docker runtime environments.cc: @mudler for review when time permits.
Signed commits