refactor: streamline consumer service retrieval and improve code read… - #36
Conversation
📝 WalkthroughWalkthrough
ChangesConsumer Deduplication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 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 docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@SW.Bus/ConsumerDiscovery.cs`:
- Around line 21-23: Remove all references and foreach blocks that call
GetServices<IConsumeGenericBase>() and GetServices<IListenGenericBase>() (these
types don't exist and produce dead code); keep the existing deduplication that
uses scope.ServiceProvider.GetServices<IConsume>().GroupBy(s =>
s.GetType()).Select(g => g.First()) but add a log entry via the available logger
(e.g., processLogger or injected ILogger in ConsumerDiscovery) when GroupBy
produces more than one item for a type to surface duplicate registrations; also
add a short inline comment above the GroupBy...Select explaining that
deduplication is required because Scrutor can register the same class multiple
times (e.g., when scanning IConsumeExtended<T>), so we intentionally pick the
first instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 14fe1039-f8c6-4a2a-946f-46452b70c574
📒 Files selected for processing (1)
SW.Bus/ConsumerDiscovery.cs
…ability
Summary by CodeRabbit