workflow_task_state_machine.go ×4

Frontier kind: Code frontier

unlabeled · c_52da6c8286e2

199 tests · 4801 LOC · 174 files · introduces 0 tests · 49 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges49 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
830 ranges4801 lines · 174 files · Browse complete extent
All tests (intent)
199 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: 49 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/workflow_task_state_machine.go 45 introduced LOC · 4 ranges

Open complete file

685 }
686
687 > func (m *workflowTaskStateMachine) skipWorkflowTaskCompletedEvent(workflowTaskType enumsspb.WorkflowTaskType, request *workflowservice.RespondWorkflowTaskCompletedRequest) bool { workflow_task_state_machine.go
688 > if workflowTaskType != enumsspb.WORKFLOW_TASK_TYPE_SPECULATIVE {
689 // Only Speculative WT can skip WorkflowTaskCompletedEvent.
690 return false
763 request *workflowservice.RespondWorkflowTaskCompletedRequest,
764 limits historyi.WorkflowTaskCompletionLimits,
765 > ) (*historypb.HistoryEvent, error) { workflow_task_state_machine.go
766 >
767 > m.ms.RemoveSpeculativeWorkflowTaskTimeoutTask()
768 >
769 > // Capture if WorkflowTaskScheduled and WorkflowTaskStarted events were created
770 > // before calling m.beforeAddWorkflowTaskCompletedEvent() because it will delete workflow task info from mutable state.
771 > workflowTaskScheduledStartedEventsCreated := !m.ms.IsTransientWorkflowTask() && workflowTask.Type != enumsspb.WORKFLOW_TASK_TYPE_SPECULATIVE
772 > m.beforeAddWorkflowTaskCompletedEvent()
773 >
774 > if m.skipWorkflowTaskCompletedEvent(workflowTask.Type, request) {
775 return nil, nil
776 }
1096
1097 // deleteWorkflowTask deletes a workflow task.
1098 > func (m *workflowTaskStateMachine) deleteWorkflowTask() { workflow_task_state_machine.go
1099 > // Get current workflow task info before deleting it, to capture timeout tasks for deletion
1100 > currentWorkflowTask := m.getWorkflowTaskInfo()
1101 > m.recordTimeoutTasksForDeletion(currentWorkflowTask)
1102 >
1103 > // Clear in-memory timeout tasks
1104 > m.ms.SetWorkflowTaskScheduleToStartTimeoutTask(nil)
1105 > m.ms.SetWorkflowTaskStartToCloseTimeoutTask(nil)
1106 >
1107 > resetWorkflowTaskInfo := &historyi.WorkflowTaskInfo{
1108 > Version: common.EmptyVersion,
1109 > ScheduledEventID: common.EmptyEventID,
1110 > StartedEventID: common.EmptyEventID,
1111 > RequestID: emptyUUID,
1112 > WorkflowTaskTimeout: time.Duration(0),
1113 > Attempt: 1,
1114 > StartedTime: time.Unix(0, 0).UTC(),
1115 > ScheduledTime: time.Unix(0, 0).UTC(),
1116 >
1117 > TaskQueue: nil,
1118 > // Keep the last original scheduled Timestamp, so that AddWorkflowTaskScheduledEventAsHeartbeat can continue with it.
1119 > OriginalScheduledTime: currentWorkflowTask.OriginalScheduledTime,
1120 > Type: enumsspb.WORKFLOW_TASK_TYPE_UNSPECIFIED,
1121 > SuggestContinueAsNew: false,
1122 > SuggestContinueAsNewReasons: nil,
1123 > HistorySizeBytes: 0,
1124 > }
1125 > m.UpdateWorkflowTask(resetWorkflowTaskInfo)
1126 > }
1127
1128 // UpdateWorkflowTask updates a workflow task.
1311 }
1312
1313 > func (m *workflowTaskStateMachine) beforeAddWorkflowTaskCompletedEvent() { workflow_task_state_machine.go
1314 > // Make sure to delete workflow task before adding events. Otherwise they are buffered rather than getting appended.
1315 > m.deleteWorkflowTask()
1316 > }
1317
1318 func (m *workflowTaskStateMachine) afterAddWorkflowTaskCompletedEvent(
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 4 introduced LOC · 2 ranges

Open complete file

4115 request *workflowservice.RespondWorkflowTaskCompletedRequest,
4116 limits historyi.WorkflowTaskCompletionLimits,
4117 > ) (*historypb.HistoryEvent, error) { mutable_state_impl.go
4118 > opTag := tag.WorkflowActionWorkflowTaskCompleted
4119 > if err := ms.checkMutability(opTag); err != nil {
4120 return nil, err
4121 }
4122 > return ms.workflowTaskManager.AddWorkflowTaskCompletedEvent(workflowTask, request, limits) mutable_state_impl.go
4123 }
4124