561
rootExecutionInfo *workflowspb.RootExecutionInfo,
562
now time.Time,
563
>
) *historyservice.StartWorkflowExecutionRequest {
util.go
564
>
// We include the original startRequest in the forwarded request to History, but
565
>
// we don't want to send workflow payloads twice. We deep copy to a new struct,
566
>
// rather than mutate the request, to accommodate internal retries.
567
>
if startRequest.ContinuedFailure != nil || startRequest.LastCompletionResult != nil {
568
startRequest = CloneProto(startRequest)
569
}
570
>
histRequest := &historyservice.StartWorkflowExecutionRequest{
util.go
571
>
NamespaceId: namespaceID,
572
>
StartRequest: startRequest,
573
>
ContinueAsNewInitiator: enumspb.CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED,
574
>
Attempt: 1,
575
>
ParentExecutionInfo: parentExecutionInfo,
576
>
FirstWorkflowTaskBackoff: durationpb.New(backoff.GetBackoffForNextScheduleNonNegative(startRequest.GetCronSchedule(), now, now)),
577
>
ContinuedFailure: startRequest.ContinuedFailure,
578
>
LastCompletionResult: startRequest.LastCompletionResult,
579
>
RootExecutionInfo: rootExecutionInfo,
580
>
VersioningOverride: startRequest.GetVersioningOverride(),
581
>
}
582
>
startRequest.ContinuedFailure = nil
583
>
startRequest.LastCompletionResult = nil
584
>
585
>
if timestamp.DurationValue(startRequest.GetWorkflowExecutionTimeout()) > 0 {
586
deadline := now.Add(timestamp.DurationValue(startRequest.GetWorkflowExecutionTimeout()))
587
histRequest.WorkflowExecutionExpirationTime = timestamppb.New(deadline.Round(time.Millisecond))