Skip to content

Commit

Permalink
add start delay
Browse files Browse the repository at this point in the history
  • Loading branch information
duoertai committed Mar 19, 2024
1 parent fb332e5 commit 46f52ae
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/api/cadence/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (t *cadenceClient) StartInterpreterWorkflow(
workflowOptions.RetryPolicy = retry.ConvertCadenceWorkflowRetryPolicy(options.RetryPolicy)
}

if options.WorkflowStartDelay != nil {
workflowOptions.DelayStart = *options.WorkflowStartDelay
}

Check warning on line 121 in service/api/cadence/client.go

View check run for this annotation

Codecov / codecov/patch

service/api/cadence/client.go#L120-L121

Added lines #L120 - L121 were not covered by tests

run, err := t.cClient.StartWorkflow(ctx, workflowOptions, cadence.Interpreter, args...)
if err != nil {
return "", err
Expand Down
4 changes: 4 additions & 0 deletions service/api/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (s *serviceImpl) ApiV1WorkflowStartPost(
Data: iwfidl.PtrString("true"),
}
}
if startOptions.WorkflowStartDelaySeconds != nil {
workflowOptions.WorkflowStartDelay =
ptr.Any(time.Duration(*startOptions.WorkflowStartDelaySeconds) * time.Second)
}

Check warning on line 120 in service/api/service.go

View check run for this annotation

Codecov / codecov/patch

service/api/service.go#L118-L120

Added lines #L118 - L120 were not covered by tests
}

input := service.InterpreterWorkflowInput{
Expand Down
4 changes: 4 additions & 0 deletions service/api/temporal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func (t *temporalClient) StartInterpreterWorkflow(
return "", err
}

if options.WorkflowStartDelay != nil {
workflowOptions.StartDelay = *options.WorkflowStartDelay
}

Check warning on line 147 in service/api/temporal/client.go

View check run for this annotation

Codecov / codecov/patch

service/api/temporal/client.go#L146-L147

Added lines #L146 - L147 were not covered by tests

run, err := t.tClient.ExecuteWorkflow(ctx, workflowOptions, temporal.Interpreter, args...)
if err != nil {
return "", err
Expand Down
1 change: 1 addition & 0 deletions service/client/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type StartWorkflowOptions struct {
RetryPolicy *iwfidl.WorkflowRetryPolicy
SearchAttributes map[string]interface{}
Memo map[string]interface{}
WorkflowStartDelay *time.Duration
}

type ListWorkflowExecutionsRequest struct {
Expand Down

0 comments on commit 46f52ae

Please sign in to comment.