task_refresher.go ×6

Frontier kind: Joint frontier

unlabeled · c_29f850960c6f

1 test · 5108 LOC · 207 files · introduces 1 test · 60 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges60 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
876 ranges5108 lines · 207 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

3 files ranked by introduced lines: 60 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/state_machine_timers.go 34 introduced LOC · 5 ranges

Open complete file

75 mutableState historyi.MutableState,
76 minVersionedTransition *persistencespb.VersionedTransition,
77 > ) error { state_machine_timers.go
78 > if transitionhistory.Compare(minVersionedTransition, EmptyVersionedTransition) == 0 {
79 > // Reset all the state machine timers, we'll recreate them all.
80 > mutableState.GetExecutionInfo().StateMachineTimers = nil
81 > return nil
82 > }
83
84 > hsmRoot := mutableState.HSM() state_machine_timers.go
85 > trimmedStateMachineTimers := make([]*persistencespb.StateMachineTimerGroup, 0, len(mutableState.GetExecutionInfo().StateMachineTimers))
86 > for _, timerGroup := range mutableState.GetExecutionInfo().StateMachineTimers {
87 > trimmedTaskInfos := make([]*persistencespb.StateMachineTaskInfo, 0, len(timerGroup.Infos))
88 > for _, taskInfo := range timerGroup.GetInfos() {
89 >
90 > node, err := hsmRoot.Child(hsm.Ref{
91 > StateMachineRef: taskInfo.Ref,
92 > }.StateMachinePath())
93 > if err != nil {
94 if errors.Is(err, hsm.ErrStateMachineNotFound) {
95 // node deleted, trim the task
99 }
100
101 > if transitionhistory.Compare( state_machine_timers.go
102 > node.InternalRepr().LastUpdateVersionedTransition,
103 > minVersionedTransition,
104 > ) >= 0 {
105 > // node recently updated, trim the task.
106 > // A complementary step is then required to regenerate timer tasks for it.
107 > continue
108 }
109
110 trimmedTaskInfos = append(trimmedTaskInfos, taskInfo)
111 }
112 > if len(trimmedTaskInfos) > 0 || timerGroup.Scheduled { state_machine_timers.go
113 > // We still want to keep the timer group if it has been scheduled even if it has no task info.
114 > // This will prevent us from scheduling a new timer task for the same group.
115 > trimmedStateMachineTimers = append(trimmedStateMachineTimers, &persistencespb.StateMachineTimerGroup{
116 > Infos: trimmedTaskInfos,
117 > Deadline: timerGroup.Deadline,
118 > Scheduled: timerGroup.Scheduled,
119 > })
120 > }
121 }
122 > mutableState.GetExecutionInfo().StateMachineTimers = trimmedStateMachineTimers state_machine_timers.go
123 > return nil
124 }
go.temporal.io/server/service/history/workflow/task_refresher.go 22 introduced LOC · 6 ranges

Open complete file

674
675 // Skip task generation if this state machine node has not been updated since minVersionedTransition.
676 > if transitionhistory.Compare( task_refresher.go
677 > node.InternalRepr().LastUpdateVersionedTransition,
678 > minVersionedTransition,
679 > ) < 0 {
680 > return nil
681 > }
682
683 > nodesToRefresh = append(nodesToRefresh, node) task_refresher.go
684 > return nil
685 }); err != nil {
686 return err
688
689 if len(nodesToRefresh) != 0 || mutableState.IsSubStateMachineDeleted() {
690 > if err := TrimStateMachineTimers(mutableState, minVersionedTransition); err != nil { task_refresher.go
691 return err
692 }
694
695 for _, node := range nodesToRefresh {
696 > taskRegenerator, err := hsm.MachineData[hsm.TaskRegenerator](node) task_refresher.go
697 > if err != nil {
698 return err
699 }
700
701 > tasks, err := taskRegenerator.RegenerateTasks(node) task_refresher.go
702 > if err != nil {
703 return err
704 }
705
706 > for _, task := range tasks { task_refresher.go
707 > if err := generateSubStateMachineTask(
708 > mutableState,
709 > r.shard.StateMachineRegistry(),
710 > node,
711 > node.Path(),
712 > node.InternalRepr().GetTransitionCount(),
713 > task,
714 > ); err != nil {
715 return err
716 }
go.temporal.io/server/api/persistence/v1/hsm.pb.go 4 introduced LOC · 1 range

Open complete file

116 }
117
118 > func (x *StateMachineNode) GetTransitionCount() int64 { hsm.pb.go
119 > if x != nil {
120 > return x.TransitionCount
121 > }
122 return 0
123 }