659
prevState := u.setState(stateProvisionallyAccepted)
660
eventStore.OnAfterCommit(func(context.Context) {
661
>
if !u.state.Matches(stateSet(stateProvisionallyAccepted | stateProvisionallyCompleted | stateProvisionallyAborted)) {
update.go
662
return
663
}
665
>
666
>
// If the Update is accepted *and* completed in the same WFT, then its state has transitioned
667
>
// from ProvisionallyAccepted to ProvisionallyCompleted in onResponseMsg by the
668
>
// time we get here.
669
>
//
670
>
// Now, to prevent a race condition in WaitLifecycleStage, the accepted future
671
>
// cannot be set here right now, as it must be set *after* the outcome future.
672
>
//
673
>
// So instead, the state is set to ProvisionallyCompletedAfterAccepted here,
674
>
// and onResponseMsg.OnAfterCommit callback will set the futures in the correct order.
675
>
if u.state == stateProvisionallyCompleted {
676
u.state = stateProvisionallyCompletedAfterAccepted
677
return