fix: prevent duplicate update operations in queue (#4131)#4171
Merged
Martí Climent (marticliment) merged 3 commits intoDevolutions:mainfrom Oct 14, 2025
Merged
Conversation
Add duplicate detection logic to the Update() method to prevent the same package from being queued multiple times during unattended updates. When auto-updates trigger repeatedly while UAC prompts are pending, the system now checks if an update operation for the package is already in queue or running before creating a new one. This prevents dozens of duplicate operations from accumulating. Fixes Devolutions#4131
Martí Climent (marticliment)
requested changes
Oct 12, 2025
Per maintainer feedback, the duplicate detection should only apply to automatic updates (UpdateAll and UpdateAllForManager), not manual user-initiated updates. This allows users to manually retry updates while still preventing duplicate operations during unattended auto-updates. Also fixed operator precedence issue in UpdateAllForManager condition.
Added 5 unit tests to verify the duplicate detection logic works correctly: - Package.GetHash() returns same value for identical packages - Package.GetHash() returns different values for different packages - Package.GetHash() differs for same package from different managers - Simulation test showing how multiple UpdateAll() calls are handled Tests mock the UAC waiting scenario where operations remain in queue, verifying that the duplicate detection prevents creating multiple operations for the same package (Manager + Source + PackageID).
2aca226 to
3733638
Compare
Contributor
Author
|
Thanks for the feedback! You're absolutely right - I've moved the duplicate detection logic to only apply during automatic updates. |
Martí Climent (marticliment)
approved these changes
Oct 14, 2025
32f4789
into
Devolutions:main
1 of 2 checks passed
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.
Any user suspected of farming GitHub activity with crypto purposes will get banned. Submitting broken code wastes the contributors' time, who have to spend their free time reviewing, fixing, and testing code that does not even compile breaks other features, or does not introduce any useful changes. I appreciate your understanding.
Description
This PR adds duplicate detection logic to prevent the same package update operation from being queued multiple times during unattended updates.
Problem
When unattended auto-updates trigger while the user is away from their PC (particularly when UAC prompts are waiting for user interaction), the
UpdateAll()method runs repeatedly and creates dozens of duplicate operations for the same package. This happens because:UpdateAll()periodically (every 60 minutes on success, 10 minutes on failure)UpdateAll()call doesn't detect the existing operation and creates duplicatesSolution
Added duplicate detection in the
Update()method (src/UniGetUI/AppOperationHelper.cs) that:UpdatePackageOperationGetHash()to compare packages by Manager, Source, and Package IDInQueueorRunningChanges
src/UniGetUI/AppOperationHelper.cs- Added 14 lines of duplicate detection logicTesting
Expected Impact
After this fix:
Closes #4131