Aaronontheweb on dev
Fix #4083 - Endpoint receive bu… (compare)
I had a code:
var events = CurrentState.Change(); PersistAll(events, e => Publisher.Publish(e)); SaveSnapshot(CurrentState);
And it produce invalid snapshots sometimes - it cannot be restored from persisted events. I assume some of events can be lost.
So I'm looking for a way to save snapshot after all events will be persisted, not just one.
Now switched to
var events = CurrentState.Change(); PersistAll(events, e => Publisher.Publish(e)); var state = CurrentState; Defer(state, s => SaveSnapshot(s));
and for me it makes sequence of:
start execute command (Receive)
mutate state (var events = Aggregate.ExecuteCommand(e))
save events (PersistAll)
atomic - while we are in Receive block, no other command can be processed, when we are saving via PersistAll, no other command can be processed
OnPersistRejectedmethod, but this won't cause actor to stop
Failed at least one assertion or threw exception. ------- Stdout: ------- DATA [Counter] Bracket: Max: 7,973.00 operations, Average: 7,973.00 operations, Min: 7,973.00 operations, StdDev: 0.00 operations [Counter] Bracket: Max / s: 16,441.10 operations, Average / s: 15,850.27 operations, Min / s: 13,593.64 operations, StdDev / s: 879.99 operations ASSERTIONS ------- Stderr: ------- [FAIL] Expected [Counter] Bracket to must be greater than 20,000.00 operations; actual value was 15,850.27 operations.