31
shardContext historyi.ShardContext,
32
workflowConsistencyChecker api.WorkflowConsistencyChecker,
33
>
) (resp *historyservice.RecordChildExecutionCompletedResponse, retError error) {
api.go
34
>
_, err := api.GetActiveNamespace(shardContext, namespace.ID(request.GetNamespaceId()), request.GetParentExecution().WorkflowId)
35
>
if err != nil {
36
return nil, err
37
}
38
39
// If the parent is reset, we need to follow a possible chain of resets to deliver the completion event to the correct parent.
40
>
redirectCount := 0
api.go
41
>
for {
42
>
resetRunID, err := recordChildWorkflowCompleted(ctx, request, shardContext, workflowConsistencyChecker)
43
>
if errors.Is(err, consts.ErrWorkflowCompleted) {
44
// if the parent was reset, forward the request to the new run pointed by resetRunID
45
// Note: An alternative solution is to load the current run here ane compare the originalRunIDs of the current run and the closed parent.