Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions service/history/api/startworkflow/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,15 @@ func (s *Starter) resolveDuplicateWorkflowID(
)

switch {
case err != nil:
return nil, StartErr, err
case errors.Is(err, api.ErrUseCurrentExecution):
return s.handleUseExistingWorkflowOnConflictOptions(
ctx,
workflowKey,
currentWorkflowConditionFailed,
currentWorkflowStartTime,
)
case err != nil:
return nil, StartErr, err
case currentExecutionUpdateAction == nil:
return nil, StartNew, nil
}
Expand Down Expand Up @@ -589,9 +589,7 @@ func extractMutableStateInfo(mutableState historyi.MutableState) (*mutableStateI
// The workflowTask returned from the mutable state call is generated on the fly and technically doesn't require
// cloning. We clone here just in case that changes.
var workflowTask historyi.WorkflowTaskInfo
if workflowTaskSource != nil {
workflowTask = *workflowTaskSource
}
workflowTask = *workflowTaskSource

return &mutableStateInfo{
branchToken: branchToken,
Expand All @@ -610,7 +608,7 @@ func (s *Starter) getWorkflowHistory(ctx context.Context, mutableState *mutableS
response, err := s.shardContext.GetExecutionManager().ReadHistoryBranch(ctx, &persistence.ReadHistoryBranchRequest{
ShardID: s.shardContext.GetShardID(),
BranchToken: mutableState.branchToken,
MinEventID: 1,
MinEventID: 2,
MaxEventID: mutableState.lastEventID,
PageSize: 1024,
})
Expand Down Expand Up @@ -778,7 +776,7 @@ func (s *Starter) generateResponse(
// TODO: consider getting the ID from mutable state, this was not done to avoid adding more complexity to
// the code to plumb that value through.
PreviousStartedEventId: 0,
StartedEventId: workflowTaskInfo.StartedEventID,
StartedEventId: workflowTaskInfo.ScheduledEventID,
Attempt: workflowTaskInfo.Attempt,
History: &historypb.History{Events: historyEvents},
NextPageToken: nil,
Expand Down