879
880
// First check retry policy to do a retry.
882
>
cronBackoff := backoff.NoBackoff
883
>
if retryBackoff == backoff.NoBackoff {
884
>
// If no retry, check cron.
885
>
cronBackoff = handler.mutableState.GetCronBackoffDuration()
886
>
}
887
889
>
if retryBackoff != backoff.NoBackoff || cronBackoff != backoff.NoBackoff {
890
newExecutionRunID = uuid.NewString()
891
}
892
893
// Always add workflow failed event
895
>
handler.workflowTaskCompletedID,
896
>
retryState,
897
>
attr,
898
>
newExecutionRunID,
899
>
)
900
>
if err != nil {
901
return nil, err
902
}
903
904
// Handle retry or cron
906
return event, handler.handleRetry(ctx, retryBackoff, attr.GetFailure(), newExecutionRunID)
908
return event, handler.handleCron(ctx, cronBackoff, nil, attr.GetFailure(), newExecutionRunID)
909
}
910
911
// No retry or cron
913
}
914