Skip to content

Handle domain event handlers concurrently with exception isolation - #75

Open
1owkeyme wants to merge 1 commit into
masterfrom
parallel-domain-events
Open

Handle domain event handlers concurrently with exception isolation#75
1owkeyme wants to merge 1 commit into
masterfrom
parallel-domain-events

Conversation

@1owkeyme

@1owkeyme 1owkeyme commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Domain-event handlers now run concurrently, improving responsiveness and preventing one handler from blocking others.
    • Processing continues when an individual handler fails, with errors recorded for troubleshooting.
  • Bug Fixes

    • Prevented deadlocks when event handlers wait on one another.
    • Ensured successful handlers continue producing follow-up events despite failures elsewhere.
  • Chores

    • Updated the project version to 4.12.0.
    • Improved project metadata formatting and excluded editor configuration files from version control.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f19549ee-e5f5-476d-abf3-4bc3551ad5c5

📥 Commits

Reviewing files that changed from the base of the PR and between 5a71d71 and 8052f56.

📒 Files selected for processing (5)
  • .gitignore
  • pyproject.toml
  • src/cqrs/events/event_emitter.py
  • tests/unit/test_event_emitter_handler_events.py
  • tests/unit/test_event_fallback.py

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The event emitter now executes domain-event handlers concurrently, isolates handler failures, logs exceptions, and collects successful follow-up events. Tests cover concurrency and failure isolation. Project metadata formatting and version information were also updated.

Changes

Concurrent domain event dispatch

Layer / File(s) Summary
Concurrent handler execution and validation
src/cqrs/events/event_emitter.py, tests/unit/test_event_emitter_handler_events.py, tests/unit/test_event_fallback.py
Domain handlers run through asyncio.gather. Handler failures are logged independently, while successful follow-up events remain collected. Tests cover concurrent execution and continued processing after an exception.

Project metadata updates

Layer / File(s) Summary
Project metadata and workspace configuration
.gitignore, pyproject.toml
Added .vscode to ignored paths, reformatted metadata entries, and updated the project version from 4.11.0 to 4.12.0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 8052f

The change dispatches domain event handlers concurrently while isolating exceptions; no actionable merge-blocking risk remains, pending normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant EventEmitter
  participant asyncio_gather
  participant DomainHandlers
  participant Logger
  EventEmitter->>asyncio_gather: schedule _process_single_handler calls
  asyncio_gather->>DomainHandlers: invoke handlers concurrently
  DomainHandlers-->>asyncio_gather: return follow-up events or exceptions
  asyncio_gather-->>EventEmitter: return handler results
  EventEmitter->>Logger: log handler exceptions with context
  EventEmitter-->>EventEmitter: collect successful follow-up events
Loading

Suggested reviewers: vadikko2

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: concurrent domain event handlers with isolated exceptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch parallel-domain-events

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@1owkeyme
1owkeyme requested a review from vadikko2 August 17, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant