-
-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure events with both Create
and Apply
are only ever handled once
#2559
Ensure events with both Create
and Apply
are only ever handled once
#2559
Conversation
Create
and Apply
are only ever handled once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me in general, but I'm unsure if when we have #2560 then if that'll be needed. Having static Apply method capabilities could be enough, as it will do upsert. The logic in this PR seems okay, but it'll add more magic to the usage pattern. @elexisvenator, @jeremydmiller thoughts?
I'm asking #2560 to be changed, and I see this as orthogonal anyway. Good stuff, I'm pulling this in now. |
Is this included in Marten 6.0? |
yes @agross! |
I was asking because after upgrading to 6.0 I tested this. The second transaction affecting the projection still calls Since the test above models a single transaction, could this be the reason why it does not work in my use case? 🤔 |
@agross unsure, please do share a repro code for us to check. |
Fixes #2528
Expected outcome: Each event passed into a projection is handled a maximum of once, either with a
Create
or anApply
method.Old behaviour: If the first event in a stream has matching
Create
andApply
methods, both would be called.New behaviour: If a
Create
method matches, that event is then skipped when iterating over apply event methods.Example of issue:
This required a bit of fiddling around with the codegeneration which I am definitly not super confident in. Pretty sure my changes are solid thanks to the tests covering them, but my approach may be off.