715
716
if !ms.IsWorkflowExecutionRunning() {
717
>
// NOTE: It is important to call this *after* applying effects to be sure there are no
api.go
718
>
// Updates in ProvisionallyCompleted state.
719
>
720
>
// Because:
721
>
// (1) all unprocessed Updates were already rejected
722
>
// (2) all accepted Updates were aborted
723
>
// the registry only has: Updates received while this WFT was running (new Updates).
724
>
hasNewRun := newMutableState != nil
725
>
if hasNewRun {
726
// If a new run was created (e.g. ContinueAsNew, Retry, Cron), then Updates that were
727
// received while this WFT was running are aborted with a retryable error.
728
// Then, the SDK will retry the API call and the Update will land on the new run.
729
updateRegistry.Abort(update.AbortReasonWorkflowContinuing)
731
>
// If the Workflow completed itself via one of the completion commands without
732
>
// creating a new run, abort all Updates with a non-retryable error.
733
>
updateRegistry.Abort(update.AbortReasonWorkflowCompleted)
734
>
}
735
}
736