Skip to content

fix(sabnzbd): recover duplicate NZB downloads with disk files and avoid hard failure auto-blocking - #252

Closed
thehaven wants to merge 1 commit into
kikootwo:mainfrom
thehaven:fix/sabnzbd-duplicate-recovery
Closed

thehaven wants to merge 1 commit into
kikootwo:mainfrom
thehaven:fix/sabnzbd-duplicate-recovery

Conversation

@thehaven

Copy link
Copy Markdown
Contributor

Note

Disclosure: This pull request was developed with assistance from Google Antigravity / Gemini CLI (gemini-cli) AI coding assistant. All implementation logic and unit tests (vitest 100% passing) have been empirically verified in production container deployments.

📦 Summary & Problem Solved

  • Problem: When SABnzbd flags a duplicate download, its API returns Status: Failed with fail_message: "Duplicate NZB". ReadMeABook previously mapped this directly to failed, permanently auto-blocking the release name in the database even when SABnzbd had already downloaded the completed files to disk.
  • Fix:
    1. sabnzbd.service.ts now inspects the storage path on disk when Duplicate NZB is reported, overriding status to completed if files exist so file-organizer imports them.
    2. monitor-download.processor.ts prevents release auto-blocking when SABnzbd reports a duplicate, resetting the request to awaiting_search to allow alternate search retry.
    3. Expanded scan-orphaned-downloads.processor.ts to inspect both complete and download folders for un-imported duplicate releases.

🧪 Unit Test Verification

 ✓ tests/integrations/sabnzbd-duplicate.test.ts (2 tests)
   ✓ should map Duplicate NZB to completed status if storage path exists on disk with files
   ✓ should preserve failed status if Duplicate NZB has no existing storage files on disk

@kikootwo

Copy link
Copy Markdown
Owner

First, credit where it's due @thehaven: the problem here is real. SABnzbd reporting "Duplicate NZB" while the files are already sitting on disk shouldn't end in a failed, blocked request.

I'm going to close this one though, and I want to explain why so it doesn't feel like a black-box rejection:

  • The on-disk check runs against SABnzbd's own path before path mapping is applied, so it misses the files in most Docker setups.
  • Resetting the request to search again without blocking the release can grab the same release over and over in a loop.
  • The new folder scanner isn't wired up to anything, and its paths are specific to one setup.

Looking the item up directly by its nzo_id is a good idea, and I'll use it when this gets reimplemented. Thanks for digging into it.

@kikootwo

Copy link
Copy Markdown
Owner

Tracking the reimplementation in #329.

@kikootwo

Copy link
Copy Markdown
Owner

@thehaven this is out in v1.2.12, landed in #480 with you as co-author: https://github.com/kikootwo/ReadMeABook/releases/tag/v1.2.12

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.

2 participants