chore(bus): avoid stop thread hop#360
Conversation
yordis
commented
May 14, 2026
- Avoids spending shutdown capacity on redundant thread pool dispatch when queue stops already provide asynchronous completion.
- Keeps shutdown failures and wait behavior observable under focused coverage.
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryMedium Risk Overview Adds focused tests to verify Reviewed by Cursor Bugbot for commit 28f7589. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughMultiQueuedHandler.Stop() changes from wrapping per-queue stops in Task.Run to direct invocation, removing task factory overhead. RecordingQueuedHandler adds configurable stop task behavior, and two new async tests validate that the overall stop operation waits for all queues and propagates exceptions. ChangesMultiQueuedHandler Stop Behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
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 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 `@src/EventStore.Core/Bus/MultiQueuedHandler.cs`:
- Around line 49-52: MultiQueuedHandler.Stop currently calls queues[i].Stop()
directly into stopTasks[i], so a synchronous exception from a queue will
short-circuit the loop and prevent later queues from being stopped; fix this by
wrapping each call in a try/catch inside the loop in Stop: attempt to assign
stopTasks[i] = queues[i].Stop(), but if queues[i].Stop() throws synchronously
catch the exception and assign stopTasks[i] = Task.FromException(exception) (or
otherwise create a faulted Task) so the loop continues and all queues get a stop
invocation; reference MultiQueuedHandler.Stop, the queues array and stopTasks[]
when making the change.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dc5df798-63e5-4454-85c9-4bac83b0e0f5
📒 Files selected for processing (2)
src/EventStore.Core.XUnit.Tests/Bus/MultiQueuedHandlerTests.cssrc/EventStore.Core/Bus/MultiQueuedHandler.cs
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>