fix(manager): populate files for completed queued downloads and add retry logic (mainly intended to fix an issue with AllDebrid) - #410
Open
jedijens wants to merge 1 commit into
Conversation
This branch has not been deployed
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
When uncached torrents finish downloading via a debrid provider (e.g. AllDebrid), processQueuedTorrent detected status TorrentStatusDownloaded but did not call applyDebridTorrentToEntry(entry, debridTorrent).
Because of this omission:
entry.Files remained empty in memory.
processSymlink() received 0 active files, logging Creating symlinks for 0 files... and creating no symlinks (causing Arr import failures).
This PR fixes the issue by:
Calling applyDebridTorrentToEntry(entry, debridTorrent) in processQueuedTorrent() so files returned by debrid status checks are synced to the entry.
Adding a retry safety net in processSymlink() (up to 6 attempts, 10s backoff) that attempts provider/directory re-checks before failing.
Target Branch Check (IMPORTANT)
Expected target:
Changes Made
pkg/manager/processor.go: CalledapplyDebridTorrentToEntry(entry, debridTorrent)inprocessQueuedTorrent(). When a queued download completes, files and provider metadata are now correctly synced toentry.Files.pkg/manager/downloader.go: Added a retry loop inprocessSymlink()(up to 6 attempts with 10s backoff) that attempts provider refresh and mount scanning (populateFilesFromMount) before failing with 0 files.Dockerfile: Addedsedto strip potential CRLF carriage returns from/entrypoint.shduring image build.Testing
Steps:
applyDebridTorrentToEntryproperly populated all files and symlinks were created successfully (Creating symlinks for 10 files...), allowing Sonarr to import the release immediately.Risks / Notes
Screenshots (if applicable)
N/A
Checklist