Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Dec 16, 2023
2 parents 9f8bf04 + 5c5234f commit f4ebabe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ func (entity *actor[T]) recoverFromSnapshot(ctx context.Context) error {
// we do have the latest state just recover from it
if event != nil {
// set the current state
if err := event.GetResultingState().UnmarshalTo(entity.currentState); err != nil {
currentState := entity.InitialState()
if err := event.GetResultingState().UnmarshalTo(currentState); err != nil {
return errors.Wrap(err, "failed unmarshal the latest state")
}
entity.currentState = currentState

// set the event counter
entity.eventsCounter.Store(event.GetSequenceNumber())
Expand Down

0 comments on commit f4ebabe

Please sign in to comment.