util.go ×5

Frontier kind: Code frontier

unlabeled · c_ff06e8f3247d

36 tests · 1258 LOC · 57 files · introduces 0 tests · 32 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges32 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
117 ranges1258 lines · 57 files · Browse complete extent
All tests (intent)
36 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 32 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/util.go 24 introduced LOC · 5 ranges

Open complete file

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))
589
590 // CronSchedule and WorkflowStartDelay should not both be set on the same request
591 > if len(startRequest.CronSchedule) != 0 { util.go
592 histRequest.ContinueAsNewInitiator = enumspb.CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE
593 }
594
595 > if timestamp.DurationValue(startRequest.GetWorkflowStartDelay()) > 0 { util.go
596 histRequest.FirstWorkflowTaskBackoff = startRequest.GetWorkflowStartDelay()
597 }
598
599 > return histRequest util.go
600 }
601
go.temporal.io/server/common/backoff/cron.go 8 introduced LOC · 2 ranges

Open complete file

33 func GetBackoffForNextSchedule(cronSchedule string, scheduledTime time.Time, now time.Time) time.Duration {
34 if len(cronSchedule) == 0 {
35 > return NoBackoff cron.go
36 > }
37
38 schedule, err := cron.ParseStandard(cronSchedule)
65
66 // GetBackoffForNextScheduleNonNegative calculates the backoff time and ensures a non-negative duration.
67 > func GetBackoffForNextScheduleNonNegative(cronSchedule string, scheduledTime time.Time, now time.Time) time.Duration { cron.go
68 > backoffDuration := GetBackoffForNextSchedule(cronSchedule, scheduledTime, now)
69 > if backoffDuration == NoBackoff || backoffDuration < 0 {
70 > backoffDuration = 0
71 > }
72 > return backoffDuration
73 }