208
// fabricateStartedEventIfMissing will transition it to started below; the executor never emitted
209
// schedule-to-start in that case, so we emit it here.
210
>
fabricatedStart := TransitionStarted.Possible(operation)
completion.go
211
>
if err := fabricateStartedEventIfMissing(node, requestID, operationToken, startTime, links); err != nil {
212
return err
213
}
214
>
if requestID != "" && operation.RequestId != requestID {
completion.go
215
isRetryableNotFoundErr = false
216
return serviceerror.NewNotFound("operation not found")
217
}
218
220
err = handleOperationError(node, operation, opFailedError)
222
err = handleSuccessfulOperationResult(node, operation, result, nil)
223
}
224
// TODO(bergundy): Remove this once the operation auto-deletes itself from the tree on completion with state
225
// based replication.
226
>
if errors.Is(err, hsm.ErrInvalidTransition) {
completion.go
227
isRetryableNotFoundErr = false
228
return serviceerror.NewNotFound("operation not found")
229
}
231
return err
232
}
233
// fabricatedStart means the executor never emitted schedule-to-start, so we emit it here.
234
>
emitScheduleToStart := fabricatedStart && operation.StartedTime != nil
completion.go
235
>
emitMetrics = h.deferredCompletionMetric(operation, node.NamespaceName(), node.WorkflowTypeName(), opFailedError, emitScheduleToStart, env.Now())
236
>
return nil
237
})
238
>
if errors.As(err, new(*serviceerror.NotFound)) && isRetryableNotFoundErr && ref.WorkflowKey.RunID != "" {
completion.go
239
// Try again without a run ID in case the original run was reset.
240
ref.WorkflowKey.RunID = ""