Adds scheduling cancellation support#9487
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces first-class scheduling APIs that return an opaque cancellation token, along with store-level cancellation support and corresponding test coverage. It also consolidates scheduling types into the main Mocha project (removing the standalone Mocha.Scheduling project).
Changes:
- Add
IMessageBus.Schedule*Async(...)APIs returningSchedulingResult, plusCancelScheduledMessageAsync(token, ...). - Extend
IScheduledMessageStoreto return a token fromPersistAsyncand supportCancelAsync(value, ...); implement Postgres cancellation SQL/store logic. - Update/expand unit and integration tests to validate cancellable results and cancellation behavior.
Reviewed changes
Copilot reviewed 23 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Mocha/src/Mocha/IMessageBus.cs | Adds scheduling + cancellation methods to the public bus API. |
| src/Mocha/src/Mocha/Middlewares/DefaultMessageBus.cs | Implements scheduling methods returning SchedulingResult and token-based cancellation. |
| src/Mocha/src/Mocha/SchedulingResult.cs | New result type carrying token + scheduled time + cancellable flag. |
| src/Mocha/src/Mocha/Scheduling/IScheduledMessageStore.cs | Changes persistence contract to return tokens; adds cancellation method. |
| src/Mocha/src/Mocha/Scheduling/DispatchSchedulingMiddleware.cs | Captures store token into a pooled feature for the bus to return. |
| src/Mocha/src/Mocha/Features/ScheduledMessageFeature.cs | New pooled feature to flow the token back to the caller. |
| src/Mocha/src/Mocha/Scheduling/* | Adds scheduler core wiring, signal abstraction, and skip/bypass features. |
| src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/Scheduling/ScheduledMessageQueries.cs | Adds SQL for cancelling scheduled messages. |
| src/Mocha/src/Mocha.EntityFrameworkCore.Postgres/Scheduling/EfCoreScheduledMessageStore.cs | Returns token on persist and implements cancellation via SQL delete. |
| src/Mocha/test/Mocha.EntityFrameworkCore.Postgres.Tests/PostgresSchedulingIntegrationTests.cs | Adds integration coverage for cancellable results + cancellation semantics in Postgres scheduling. |
| src/Mocha/test/Mocha.Tests/Scheduling/* | Updates/expands tests for new scheduling APIs and in-memory cancellation behavior. |
| src/Mocha/test/Mocha.Sagas.TestHelpers/TestMessageBus.cs | Updates test helper bus to satisfy new IMessageBus scheduling API surface. |
| .csproj / Mocha.slnx / src/Mocha/src/Mocha.Scheduling/ | Removes the standalone Mocha.Scheduling project and related references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9487 +/- ##
==========================================
- Coverage 74.16% 0 -74.17%
==========================================
Files 2677 0 -2677
Lines 140790 0 -140790
Branches 16371 0 -16371
==========================================
- Hits 104421 0 -104421
+ Misses 30774 0 -30774
+ Partials 5595 0 -5595
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.