fix: prevent duplicate update operations in queue (#4131) #4171
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