Remove unnecessary CAS guard from SubscriptionProvider.updateTopics()#8407
Remove unnecessary CAS guard from SubscriptionProvider.updateTopics()#8407zhangchiqing merged 2 commits intomasterfrom
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughRemoved atomic-based concurrency guard from SubscriptionProvider's topic update mechanism. The allTopicsUpdate atomic.Bool field and related CompareAndSwap logic were deleted, simplifying updateTopics to rely on single-threaded execution driven by a ticker loop instead of cross-goroutine synchronization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Problem
updateTopics()refreshes peer subscription data every 10 minutes, used to penalize peers subscribing to unauthorized topics. An inverted CAS guard caused every other update to be skipped, doubling the check interval to 20 minutes.Solution
Remove the CAS guard. It's unnecessary since
updateTopics()is only called from a single-goroutine ticker loop—no concurrent calls are possible.Summary by CodeRabbit