Skip to content

Commit

Permalink
Dedup SignalWithStart based on RequestId (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminc authored Jan 7, 2022
1 parent cf6c03e commit d01b1c7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,13 @@ func (e *historyEngineImpl) SignalWithStartWorkflowExecution(
return nil, consts.ErrSignalsLimitExceeded
}

if sRequest.GetRequestId() != "" && mutableState.IsSignalRequested(sRequest.GetRequestId()) {
// duplicate signal
return &historyservice.SignalWithStartWorkflowExecutionResponse{RunId: context.GetExecution().RunId}, nil
}
if sRequest.GetRequestId() != "" {
mutableState.AddSignalRequested(sRequest.GetRequestId())
}
if _, err := mutableState.AddWorkflowExecutionSignaled(
sRequest.GetSignalName(),
sRequest.GetSignalInput(),
Expand Down Expand Up @@ -2076,6 +2083,9 @@ func (e *historyEngineImpl) SignalWithStartWorkflowExecution(
}

// Add signal event
if sRequest.GetRequestId() != "" {
mutableState.AddSignalRequested(sRequest.GetRequestId())
}
if _, err := mutableState.AddWorkflowExecutionSignaled(
sRequest.GetSignalName(),
sRequest.GetSignalInput(),
Expand Down

0 comments on commit d01b1c7

Please sign in to comment.