Skip to content

Commit

Permalink
Only load complete event for standby close task if needed (#3209)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminc authored Aug 10, 2022
1 parent 9be1e18 commit 3c6abda
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions service/history/transferQueueStandbyTaskExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ func (t *transferQueueStandbyTaskExecutor) processCloseExecution(
return nil, nil
}

completionEvent, err := mutableState.GetCompletionEvent(ctx)
if err != nil {
return nil, err
}
wfCloseTime, err := mutableState.GetWorkflowCloseTime(ctx)
if err != nil {
return nil, err
Expand Down Expand Up @@ -277,7 +273,17 @@ func (t *transferQueueStandbyTaskExecutor) processCloseExecution(
}

// verify if parent got the completion event
verifyCompletionRecorded := mutableState.HasParentExecution() && executionInfo.NewExecutionRunId == "" && !IsTerminatedByResetter(completionEvent)
verifyCompletionRecorded := mutableState.HasParentExecution() && executionInfo.NewExecutionRunId == ""
if verifyCompletionRecorded {
// load close event only if needed.
completionEvent, err := mutableState.GetCompletionEvent(ctx)
if err != nil {
return nil, err
}

verifyCompletionRecorded = verifyCompletionRecorded && !IsTerminatedByResetter(completionEvent)
}

if verifyCompletionRecorded {
_, err := t.historyClient.VerifyChildExecutionCompletionRecorded(ctx, &historyservice.VerifyChildExecutionCompletionRecordedRequest{
NamespaceId: executionInfo.ParentNamespaceId,
Expand Down

0 comments on commit 3c6abda

Please sign in to comment.