timer_queue_active_task_executor.go ×13

Frontier kind: Code frontier

unlabeled · c_8cc068e254e6

4 tests · 9737 LOC · 268 files · introduces 0 tests · 33 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges33 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2105 ranges9737 lines · 268 files · Browse complete extent
All tests (intent)
4 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.

1 file ranked by introduced lines: 33 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/timer_queue_active_task_executor.go 33 introduced LOC · 13 ranges

Open complete file

110 case *tasks.WorkflowTaskTimeoutTask:
111 err = t.executeWorkflowTaskTimeoutTask(ctx, task)
112 > case *tasks.WorkflowRunTimeoutTask: timer_queue_active_task_executor.go
113 > err = t.executeWorkflowRunTimeoutTask(ctx, task)
114 case *tasks.WorkflowExecutionTimeoutTask:
115 err = t.executeWorkflowExecutionTimeoutTask(ctx, task)
646 ctx context.Context,
647 task *tasks.WorkflowRunTimeoutTask,
648 > ) (retError error) { timer_queue_active_task_executor.go
649 > ctx, cancel := context.WithTimeout(ctx, taskTimeout)
650 > defer cancel()
651 >
652 > weContext, release, err := getWorkflowExecutionContextForTask(ctx, t.shardContext, t.cache, task)
653 > if err != nil {
654 return err
655 }
656 > defer func() { release(retError) }() timer_queue_active_task_executor.go
657
658 > mutableState, err := loadMutableStateForTimerTask(ctx, t.shardContext, weContext, task, t.metricsHandler, t.logger) timer_queue_active_task_executor.go
659 > if err != nil {
660 return err
661 }
662 > if mutableState == nil { timer_queue_active_task_executor.go
663 release(nil) // release(nil) so mutable state is not unloaded from cache
664 return consts.ErrWorkflowExecutionNotFound
665 }
666 > if !mutableState.IsWorkflowExecutionRunning() { timer_queue_active_task_executor.go
667 release(nil) // release(nil) so mutable state is not unloaded from cache
668 return consts.ErrWorkflowCompleted
669 }
670
671 > startVersion, err := mutableState.GetStartVersion() timer_queue_active_task_executor.go
672 > if err != nil {
673 return err
674 }
675 > err = CheckTaskVersion(t.shardContext, t.logger, mutableState.GetNamespaceEntry(), startVersion, task.Version, task) timer_queue_active_task_executor.go
676 > if err != nil {
677 return err
678 }
679
680 > if !t.isValidWorkflowRunTimeoutTask(mutableState, task) { timer_queue_active_task_executor.go
681 release(nil) // release(nil) so mutable state is not unloaded from cache
682 return errNoTimerFired
683 }
684
685 > timeoutFailure := failure.NewTimeoutFailure("workflow timeout", enumspb.TIMEOUT_TYPE_START_TO_CLOSE) timer_queue_active_task_executor.go
686 > backoffInterval := backoff.NoBackoff
687 > retryState := enumspb.RETRY_STATE_TIMEOUT
688 > initiator := enumspb.CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED
689 >
690 > wfExpTime := mutableState.GetExecutionInfo().WorkflowExecutionExpirationTime
691 > if wfExpTime == nil || wfExpTime.AsTime().IsZero() || wfExpTime.AsTime().After(mutableState.Now()) {
692 backoffInterval, retryState = mutableState.GetRetryBackoffDuration(timeoutFailure)
693 if backoffInterval != backoff.NoBackoff {
700 }
701
702 > var newRunID string timer_queue_active_task_executor.go
703 > if initiator != enumspb.CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED {
704 newRunID = uuid.NewString()
705 }
706
707 // First add timeout workflow event, no matter what we're doing next.
708 > if err := workflow.TimeoutWorkflow( timer_queue_active_task_executor.go
709 > mutableState,
710 > retryState,
711 > newRunID,
712 > ); err != nil {
713 return err
714 }
715
716 // No more retries, or workflow is expired.
717 > if initiator == enumspb.CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED { timer_queue_active_task_executor.go
718 // We apply the update to execution using optimistic concurrency. If it fails due to a conflict than reload
719 // the history and try the operation again.