Skip to content

Commit

Permalink
Remove unused default IDReusePolicy for SignalWithStart (cadence-work…
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored and mkolodezny committed May 11, 2020
1 parent a38395d commit c14d8ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 1 addition & 9 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,17 +581,10 @@ func (e *historyEngineImpl) startWorkflowHelper(
prevLastWriteVersion,
)
}
// for signalWithStart, WorkflowIDReusePolicy is default to WorkflowIDReusePolicyAllowDuplicate
// while for startWorkflow it is default to WorkflowIdReusePolicyAllowDuplicateFailedOnly.
policy := workflow.WorkflowIdReusePolicyAllowDuplicate
if request.WorkflowIdReusePolicy != nil {
policy = request.GetWorkflowIdReusePolicy()
}

err = e.applyWorkflowIDReusePolicyForSigWithStart(
prevMutableState.GetExecutionInfo(),
workflowExecution,
policy,
request.GetWorkflowIdReusePolicy(),
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -2850,7 +2843,6 @@ func getStartRequest(
return startRequest
}

// for startWorkflowExecution & signalWithStart to handle workflow reuse policy
func (e *historyEngineImpl) applyWorkflowIDReusePolicyForSigWithStart(
prevExecutionInfo *persistence.WorkflowExecutionInfo,
execution workflow.WorkflowExecution,
Expand Down
6 changes: 6 additions & 0 deletions service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_WorkflowNotRunning()
signalName := "my signal name"
input := []byte("test input")
requestID := uuid.New()
policy := workflow.WorkflowIdReusePolicyAllowDuplicate
sRequest = &h.SignalWithStartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
SignalWithStartRequest: &workflow.SignalWithStartWorkflowExecutionRequest{
Expand All @@ -1296,6 +1297,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_WorkflowNotRunning()
SignalName: common.StringPtr(signalName),
Input: input,
RequestId: common.StringPtr(requestID),
WorkflowIdReusePolicy: &policy,
},
}

Expand Down Expand Up @@ -1327,6 +1329,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_Start_DuplicateReque
signalName := "my signal name"
input := []byte("test input")
requestID := "testRequestID"
policy := workflow.WorkflowIdReusePolicyAllowDuplicate
sRequest := &h.SignalWithStartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
SignalWithStartRequest: &workflow.SignalWithStartWorkflowExecutionRequest{
Expand All @@ -1340,6 +1343,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_Start_DuplicateReque
SignalName: common.StringPtr(signalName),
Input: input,
RequestId: common.StringPtr(requestID),
WorkflowIdReusePolicy: &policy,
},
}

Expand Down Expand Up @@ -1379,6 +1383,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_Start_WorkflowAlread
signalName := "my signal name"
input := []byte("test input")
requestID := "testRequestID"
policy := workflow.WorkflowIdReusePolicyAllowDuplicate
sRequest := &h.SignalWithStartWorkflowExecutionRequest{
DomainUUID: common.StringPtr(domainID),
SignalWithStartRequest: &workflow.SignalWithStartWorkflowExecutionRequest{
Expand All @@ -1392,6 +1397,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_Start_WorkflowAlread
SignalName: common.StringPtr(signalName),
Input: input,
RequestId: common.StringPtr(requestID),
WorkflowIdReusePolicy: &policy,
},
}

Expand Down

0 comments on commit c14d8ab

Please sign in to comment.