Fix download import pipeline for single-file torrents#350
Closed
zombopanda wants to merge 5 commits intoListenarrs:canaryfrom
Closed
Fix download import pipeline for single-file torrents#350zombopanda wants to merge 5 commits intoListenarrs:canaryfrom
zombopanda wants to merge 5 commits intoListenarrs:canaryfrom
Conversation
7 tasks
Collaborator
|
@zombopanda Are you sure you checked against 0.2.48? There was an issue with the image package being private rather than public so anyone using the Github image url was not getting the latest version. |
Fixes multiple issues causing single-file torrent downloads (e.g. from MyAnonamouse) to fail to import or to catastrophically import the entire downloads directory: 1. DownloadMonitorService cookie auth: The factory HttpClient "DownloadClient" has UseCookies=false, which drops the qBittorrent SID cookie. Create a local HttpClient with its own CookieContainer so the login cookie persists across requests. 2. Single-file torrent path resolution (QbittorrentAdapter): For single-file torrents the file name has no directory component, so subfolder was empty and outputPath resolved to just save_path (the entire downloads directory). Now use Path.Combine(savePath, fileName) for single-file torrents. 3. Race condition between completion and processing: DownloadMonitorService was setting status to Completed immediately when a candidate was first observed, before the stability window expired. This allowed DownloadProcessingBackgroundService to pick up the download too early. Now only update progress to 100% without changing status until after finalization. 4. DownloadProcessingBackgroundService path fallback: Was using dl.FinalPath ?? dl.DownloadPath which resolved to save_path for single-file torrents. Now prefers ClientContentPath from metadata (the torrent's content_path) which points to the actual file. 5. Purge safety check (DownloadService): Skip orphan purge when the download client returns 0 queue items but active downloads exist, preventing accidental deletion during transient connectivity issues. 6. EF Core version wildcards: Use 8.* for all EF Core packages to avoid NU1605 version mismatch warnings during restore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3ff7ed8 to
aa45756
Compare
Contributor
Author
|
Hey @therobbiedavis, yes — confirmed these issues are still present in both 0.2.48 and 0.2.49 (canary). I verified against the latest origin/canary (42ddbd1):
|
Playwright services were removed from the codebase but the Dockerfile still tried to install Playwright via PowerShell, causing build failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When ApplicationSettings.OutputPath is not configured, the finalization code fell back to "./completed" which resolves to /app/completed inside the container — a path the process cannot write to. Now queries the first configured root folder path as the fallback instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
@zombopanda I am going to cherry pick this into a larger effort branch around download client behavior reliability, but this will be in the next release barring any major critical issues cropping up. |
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.
Summary
Fixes multiple issues causing single-file torrent downloads (e.g. from MyAnonamouse) to fail to import, or to catastrophically import the entire downloads directory instead of the target file.
QbittorrentAdapter.GetImportItemAsync): For single-file torrents the file name has no directory component, sosubfolderwas empty andoutputPathresolved tosave_path(the entire downloads directory). Now usesPath.Combine(savePath, fileName)for single-file torrents. Fixed in both overloads of the method.DownloadMonitorService): Was settingdl.Status = DownloadStatus.Completedimmediately when a completion candidate was first observed, before the stability window expired. This allowedDownloadProcessingBackgroundServiceto pick up the download and start importing prematurely. Now only updates progress to 100% without changing status until after the stability window and finalization.DownloadProcessingBackgroundService): Was usingdl.FinalPath ?? dl.DownloadPathwhich resolved tosave_pathfor single-file torrents. Now prefersClientContentPathfrom download metadata (content_path= actual file/folder path).DownloadService): Skips orphan purge when the download client returns 0 queue items but active downloads exist, preventing accidental record deletion during transient client connectivity issues.Test plan
canary(0.2.48 + Prowlarr integration)/data/downloads/file.m4b, not/data/downloads/)🤖 Generated with Claude Code