fix: prevent rule-removed items from being re-added as manual additions#2440
Merged
ydkmlt84 merged 1 commit intoMar 1, 2026
Merged
Conversation
After handleCollection() removes an item by rule, the media server API may still return the item as a collection child due to sync delay. The syncManualMediaServerToCollectionDB() method checks touchedMediaServerIds to skip these stale items in the removal loop, but was missing the same guard in the addition loop. This caused removed items to be immediately re-added as manual additions. Add the touchedMediaServerIds guard to the manually-added loop so items just processed by rules are not mistakenly treated as manual additions.
Contributor
|
🎉 This PR is included in version 3.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
After PR #2429 introduced
touchedMediaServerIdsto preventsyncManualMediaServerToCollectionDB()from double-handling items that were just processed by rule execution, the guard was only applied to the manually removed loop — not the manually added loop.Race condition
handleCollection()removes item X (rule evaluated false) — deletes from both DB and media server collectionsyncManualMediaServerToCollectionDB()runs immediately aftergetCollectionChildren()may still return X from the media server API (sync delay — especially on Jellyfin, but also possible on Plex)Fix
Add the
touchedMediaServerIdsguard to the manually-added loop (mirroring the existing guard in the removal loop), so items just processed by rules are skipped and not mistakenly treated as manual additions.Testing
does not re-add a rule-removed item as manual when media server returns stale children