Skip to content

Commit

Permalink
IWF-254: Override WorkflowConfig field by field (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski authored Nov 13, 2024
1 parent 9973d43 commit 6d69103
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion service/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (s *serviceImpl) ApiV1WorkflowStartPost(
initCustomSAs = startOptions.SearchAttributes
initCustomDAs = startOptions.DataAttributes
if startOptions.HasWorkflowConfigOverride() {
workflowConfig = startOptions.GetWorkflowConfigOverride()
configOverride := startOptions.GetWorkflowConfigOverride()
overrideWorkflowConfig(configOverride, &workflowConfig)
}

workflowAlreadyStartedOptions := startOptions.WorkflowAlreadyStartedOptions
Expand Down Expand Up @@ -192,6 +193,24 @@ func (s *serviceImpl) ApiV1WorkflowStartPost(
}, nil
}

func overrideWorkflowConfig(configOverride iwfidl.WorkflowConfig, workflowConfig *iwfidl.WorkflowConfig) {
if configOverride.ExecutingStateIdMode != nil {
workflowConfig.ExecutingStateIdMode = configOverride.ExecutingStateIdMode
}
if configOverride.ContinueAsNewThreshold != nil {
workflowConfig.ContinueAsNewThreshold = configOverride.ContinueAsNewThreshold
}
if configOverride.ContinueAsNewPageSizeInBytes != nil {
workflowConfig.ContinueAsNewPageSizeInBytes = configOverride.ContinueAsNewPageSizeInBytes
}
if configOverride.DisableSystemSearchAttribute != nil {
workflowConfig.DisableSystemSearchAttribute = configOverride.DisableSystemSearchAttribute
}
if configOverride.OptimizeActivity != nil {
workflowConfig.OptimizeActivity = configOverride.OptimizeActivity
}
}

func (s *serviceImpl) ApiV1WorkflowWaitForStateCompletion(
ctx context.Context, req iwfidl.WorkflowWaitForStateCompletionRequest,
) (wresp *iwfidl.WorkflowWaitForStateCompletionResponse, retError *errors.ErrorAndStatus) {
Expand Down

0 comments on commit 6d69103

Please sign in to comment.