@@ -26,10 +26,11 @@ import (
26
26
"encoding/json"
27
27
"errors"
28
28
"fmt"
29
- "go.uber.org/cadence/internal/common/serializer"
30
29
"reflect"
31
30
"time"
32
31
32
+ "go.uber.org/cadence/internal/common/serializer"
33
+
33
34
"github.com/opentracing/opentracing-go"
34
35
"github.com/pborman/uuid"
35
36
"github.com/uber-go/tally"
@@ -188,6 +189,11 @@ func (wc *workflowClient) StartWorkflow(
188
189
return nil , err
189
190
}
190
191
192
+ delayStartSeconds := common .Int32Ceil (options .DelayStart .Seconds ())
193
+ if delayStartSeconds < 0 {
194
+ return nil , errors .New ("Invalid DelayStart option" )
195
+ }
196
+
191
197
// create a workflow start span and attach it to the context object.
192
198
// N.B. we need to finish this immediately as jaeger does not give us a way
193
199
// to recreate a span given a span context - which means we will run into
@@ -218,6 +224,7 @@ func (wc *workflowClient) StartWorkflow(
218
224
Memo : memo ,
219
225
SearchAttributes : searchAttr ,
220
226
Header : header ,
227
+ DelayStartSeconds : common .Int32Ptr (delayStartSeconds ),
221
228
}
222
229
223
230
var response * s.StartWorkflowExecutionResponse
@@ -386,6 +393,11 @@ func (wc *workflowClient) SignalWithStartWorkflow(ctx context.Context, workflowI
386
393
return nil , err
387
394
}
388
395
396
+ delayStartSeconds := common .Int32Ceil (options .DelayStart .Seconds ())
397
+ if delayStartSeconds < 0 {
398
+ return nil , errors .New ("Invalid DelayStart option" )
399
+ }
400
+
389
401
// create a workflow start span and attach it to the context object. finish it immediately
390
402
ctx , span := createOpenTracingWorkflowSpan (ctx , wc .tracer , time .Now (), fmt .Sprintf ("SignalWithStartWorkflow-%s" , workflowType .Name ), workflowID )
391
403
span .Finish ()
@@ -411,6 +423,7 @@ func (wc *workflowClient) SignalWithStartWorkflow(ctx context.Context, workflowI
411
423
SearchAttributes : searchAttr ,
412
424
WorkflowIdReusePolicy : options .WorkflowIDReusePolicy .toThriftPtr (),
413
425
Header : header ,
426
+ DelayStartSeconds : common .Int32Ptr (delayStartSeconds ),
414
427
}
415
428
416
429
var response * s.StartWorkflowExecutionResponse
0 commit comments