feat: replace EventSourced::Services with Jobs and wire atomic enqueue#15
feat: replace EventSourced::Services with Jobs and wire atomic enqueue#150xgleb wants to merge 1 commit into
Conversation
|
Warning Review limit reached
More reviews will be available in 18 minutes and 37 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (17)
✨ 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 |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label add-to-gt-merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
f8d5519 to
fa00224
Compare
910433d to
c5c503c
Compare
c5c503c to
a755cb4
Compare
a755cb4 to
207ae2c
Compare
207ae2c to
7159bba
Compare
7159bba to
14d1da0
Compare
14d1da0 to
177dc0c
Compare
177dc0c to
23d66f7
Compare
23d66f7 to
a0945e0
Compare
a0945e0 to
a2a190c
Compare
a2a190c to
e2743b6
Compare
52388ad to
e2743b6
Compare
e2743b6 to
64a435a
Compare
64a435a to
f7b49c2
Compare
f7c21f5 to
1ac9ec5
Compare
f7b49c2 to
a14c560
Compare
a14c560 to
72cd628
Compare
72cd628 to
97bdb7d
Compare
97bdb7d to
b77e4d4
Compare

Motivation
The crash-safety gap ADR-0001 exists to close: with
type Services, handlers runside effects before events persist, so a crash between the two orphans the
action. This change makes handlers pure and wires job enqueue into the same
transaction that commits events.
Solution
EventSourced: droptype Services, addtype Jobs: JobList;initialize/transitionbecome sync and take&mut JobQueue<Self::Jobs>; thetrait sheds
#[async_trait]. Service reads (clock, config) move into theCommand.Store::send/send_commandrun the handler inside awith_pending_jobstask-local scope; the
Lifecyclehandler buffers itsJobQueueviabuffer_pending;SqliteEventRepositorydrains it withflush_pending_jobsinside the event-commit transaction.
silently lost;
JobList: Sendso the queue threads through theSendcommandfuture.
servicesparameter fromsend_command,test_store,TestHarness::with,TestStore::new/with_reactor,StoreBuilder::build,and
sqlite_snapshot_cqrs;Lifecycle::Servicescollapses to().Pendingjob row written together).Closes RAI-918.