-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix: Use new state in snapshotWhen #32462
Conversation
@@ -574,6 +572,8 @@ private[akka] object Running { | |||
} | |||
|
|||
currentState = currentState.applyEvent(setup, event) | |||
if (shouldSnapshotAfterPersist == NoSnapshot) | |||
shouldSnapshotAfterPersist = setup.shouldSnapshot(currentState.state, event, _currentSequenceNumber) |
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.
it's correct for persist of one event, but not for this persistAll case
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.
If that is the case (and I do believe you), are we missing a test case?
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.
So, in case of persistAll, we were saying an out-of-date state? 😱
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.
I think, only the shouldSnapshot
predicate did get passed in the old state, before the event was applied.
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.
If that is the case (and I do believe you), are we missing a test case?
Probably not much testing on that detail. I'm afraid I don't have time to add any before my vacation. I'm confident that this is correct and can be merged, but feel free to follow up with more tests.
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.
LGTM
@@ -574,6 +572,8 @@ private[akka] object Running { | |||
} | |||
|
|||
currentState = currentState.applyEvent(setup, event) | |||
if (shouldSnapshotAfterPersist == NoSnapshot) | |||
shouldSnapshotAfterPersist = setup.shouldSnapshot(currentState.state, event, _currentSequenceNumber) |
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.
So, in case of persistAll, we were saying an out-of-date state? 😱
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.
LGTM
No description provided.