Fix canceled Program queries caching empty results#4502
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR improves cancellation handling in the Program plugin's QueryAsync method to prevent canceled searches from populating the cache. The implementation refactors lock acquisition to use try/finally patterns with outer-scope exception handling, while a new test fixture comprehensively validates that canceled queries return empty results without caching. ChangesCancellation Handling and Testing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by cubic
Stops caching empty results when Program queries are canceled, so follow-up searches return the correct apps. Adds a unit test to ensure canceled searches never poison the cache.
Summary of changes
OperationCanceledExceptionat the top ofQueryAsyncaroundcache.GetOrCreateAsync(...), letting cancellation bubble out so no cache entry is created; simplified lock acquire/release withtry+finally(no inner catches).emptyResultsfor canceled queries, without caching.catch (OperationCanceledException)blocks during Win32 and UWP preparation and scoring.ProgramPluginTest.QueryAsync_DoesNotCacheCanceledResultsAsyncto verify canceled queries don’t cache and subsequent queries return expected results.Release Note
Canceled searches no longer cache empty results, so future searches show the right apps.
Written for commit 70348b1. Summary will update on new commits.