Skip to content

Commit

Permalink
Split map function
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Sep 6, 2022
1 parent de89351 commit 2fc5d02
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions service/frontend/workflow_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4760,15 +4760,17 @@ func (wh *WorkflowHandler) mapCreateScheduleRequestSearchAttributes(request *wor
// Shallow copy request and replace SearchAttributes fields only.
newRequest := *request
newRequest.SearchAttributes = mappedSearchAttributes
return &newRequest, nil
}

// map search attributes to aliases here, since we don't go through the frontend when starting later
func (wh *WorkflowHandler) mapCreateScheduleRequestStartWorkflowSearchAttributes(request *workflowservice.CreateScheduleRequest, namespaceName namespace.Name) (*workflowservice.CreateScheduleRequest, error) {
if startWorkflow := request.GetSchedule().GetAction().GetStartWorkflow(); startWorkflow != nil {
mappedSearchAttributes, err := searchattribute.SubstituteAliases(wh.saMapper, startWorkflow.GetSearchAttributes(), namespaceName.String())
if err != nil {
return nil, err
}
if mappedSearchAttributes == nil {
return &newRequest, nil
return request, nil
}
newStartWorkflow := *startWorkflow
newStartWorkflow.SearchAttributes = mappedSearchAttributes
Expand All @@ -4777,8 +4779,10 @@ func (wh *WorkflowHandler) mapCreateScheduleRequestSearchAttributes(request *wor
Action: &schedpb.ScheduleAction_StartWorkflow{
StartWorkflow: &newStartWorkflow,
}}
newRequest := *request
newRequest.Schedule = &newSchedule
return &newRequest, nil
}

return &newRequest, nil
return request, nil
}

0 comments on commit 2fc5d02

Please sign in to comment.