1096
1097
// deleteWorkflowTask deletes a workflow task.
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.