Skip to content

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
sirrobot01:betafrom
jedijens:fix/queued-download-symlink-files
Open

jedijens wants to merge 1 commit into
sirrobot01:betafrom
jedijens:fix/queued-download-symlink-files

Conversation

@jedijens

@jedijens jedijens commented Sep 8, 2026

Copy link
Copy Markdown

📌 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)

  • I confirm this PR is targeting the correct branch

Expected target:

  • beta (for features)

Changes Made

  • pkg/manager/processor.go: Called applyDebridTorrentToEntry(entry, debridTorrent) in processQueuedTorrent(). When a queued download completes, files and provider metadata are now correctly synced to entry.Files.
  • pkg/manager/downloader.go: Added a retry loop in processSymlink() (up to 6 attempts with 10s backoff) that attempts provider refresh and mount scanning (populateFilesFromMount) before failing with 0 files.
  • Dockerfile: Added sed to strip potential CRLF carriage returns from /entrypoint.sh during image build.

Testing

  • Tested locally

Steps:

  1. Built container image using Docker Compose on Linux host.
  2. Submitted an uncached season pack via Sonarr with AllDebrid provider.
  3. Monitored logs while the torrent finished downloading in the queue: verified applyDebridTorrentToEntry properly populated all files and symlinks were created successfully (Creating symlinks for 10 files...), allowing Sonarr to import the release immediately.

Risks / Notes

  • None identified. Should be safe and backward-compatible fix.

Screenshots (if applicable)

N/A

Checklist

  • Code builds successfully
  • No console/log errors
  • Reviewed my own code
  • Target branch is correct

This branch has not been deployed

No deployments
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