fix(importer): improve ARR import stability and queue handling#591
Merged
Conversation
Contributor
Author
|
Updates to PR #591: Replaced the arbitrary 3-second sleep with a robust poll-until-exists check for the VFS mount in internal/importer/postprocessor/coordinator.go. This ensures ARR applications only receive import notifications once the file is fully visible, eliminating 'FileNotFoundException' race conditions while maximizing responsiveness. |
56901c0 to
0405dc2
Compare
…ion fixes This comprehensive set of fixes resolves long-standing issues with Sonarr/Radarr queue synchronization and accidental file deletion: ### 1. ARR Queue Stability and Visibility - State Synchronization: Refactored History API to proactively surface completed items from the active import queue. This prevents a race condition where successfully imported files vanish from Sonarr's sight because they haven't yet been persisted to the ImportHistory database. - Improved Deduplication: Added deduplication logic in handleSABnzbdHistory to handle the overlap between active queue items and historical records. - Queue Limit Logic: Fixed SABnzbd Queue API limit handling. - ARR Queue Cleanup: Added a proactive removal trigger for successfully imported items via webhook, and implemented a more robust polling mechanism in the post-processor to ensure ARR applications only get notifications when files are fully visible on the VFS mount. ### 2. Health-Aware Deletion Guard - Race Condition Resolution: Resolved a bug in the Redundant Deletion Guard where it blindly honored ARR EpisodeFileDelete webhooks even for files that had just been successfully verified as healthy. - Health-Aware Logic: Updated the guard in arrs_handlers.go to query the healthRepo before proceeding. Deletion is now skipped if the file is confirmed Healthy and was recently imported (within 5 minutes). - Grace Period: This prevents stale webhook events from previous failed import attempts (common during high-frequency retries) from deleting successfully imported media. ### 3. Stability & API Refinements - Improved ID Persistence: Ensured DownloadID is correctly captured and persisted into ImportHistory. - API Compatibility: Cleaned up the SABnzbd History API, decoupling it from the active queue while ensuring consistency with Sonarr's expectations.
iPromKnight
added a commit
to iPromKnight/altmount
that referenced
this pull request
May 18, 2026
…am conflict Upstream main extended the if/else chain to add whisparr, lidarr, and readarr cases in javi11#591. The drive-by tagged-switch cleanup from the previous commit conflicts with that change. The lint finding (QF1003) predates this PR and persists on main — appropriate venue is a separate PR that resolves the conflict cleanly by extending the switch with the new cases. Keeps this PR scoped to the slot-semaphore refactor.
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.
This pull request resolves several issues causing Sonarr/Radarr queue instability:
These changes ensure ARR instances can accurately track and clear processed items from their queues, improving overall stability of the import lifecycle.