Skip to content

Commit

Permalink
Fix admin handler getTaskType implementation (#2474)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt authored Feb 8, 2022
1 parent 16871d7 commit fb8a5e0
Showing 1 changed file with 37 additions and 5 deletions.
42 changes: 37 additions & 5 deletions service/frontend/adminHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1728,22 +1728,54 @@ func (adh *AdminHandler) error(err error, scope metrics.Scope) error {
func getTaskType(task tasks.Task) (enumsspb.TaskType, error) {
var taskType enumsspb.TaskType
switch task := task.(type) {
// Replication
case *tasks.HistoryReplicationTask:
taskType = enumsspb.TASK_TYPE_REPLICATION_HISTORY
case *tasks.SyncActivityTask:
taskType = enumsspb.TASK_TYPE_REPLICATION_SYNC_ACTIVITY
// Transfer
case *tasks.WorkflowTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_WORKFLOW_TASK
case *tasks.ActivityTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_ACTIVITY_TASK
case *tasks.CloseExecutionTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_CLOSE_EXECUTION
case *tasks.CancelExecutionTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_CANCEL_EXECUTION
case *tasks.StartChildExecutionTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_START_CHILD_EXECUTION
case *tasks.SignalExecutionTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_SIGNAL_EXECUTION
case *tasks.ResetWorkflowTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_RESET_WORKFLOW
case *tasks.DeleteExecutionTask:
taskType = enumsspb.TASK_TYPE_TRANSFER_DELETE_EXECUTION
// Timer
case *tasks.WorkflowTaskTimeoutTask:
taskType = enumsspb.TASK_TYPE_WORKFLOW_TASK_TIMEOUT
case *tasks.WorkflowBackoffTimerTask:
taskType = enumsspb.TASK_TYPE_WORKFLOW_BACKOFF_TIMER
case *tasks.ActivityTimeoutTask:
taskType = enumsspb.TASK_TYPE_ACTIVITY_TIMEOUT
case *tasks.ActivityRetryTimerTask:
taskType = enumsspb.TASK_TYPE_ACTIVITY_RETRY_TIMER
case *tasks.UserTimerTask:
taskType = enumsspb.TASK_TYPE_USER_TIMER
case *tasks.WorkflowTimeoutTask:
taskType = enumsspb.TASK_TYPE_WORKFLOW_RUN_TIMEOUT
case *tasks.DeleteHistoryEventTask:
taskType = enumsspb.TASK_TYPE_DELETE_HISTORY_EVENT
case *tasks.ActivityRetryTimerTask:
taskType = enumsspb.TASK_TYPE_ACTIVITY_RETRY_TIMER
case *tasks.WorkflowBackoffTimerTask:
taskType = enumsspb.TASK_TYPE_WORKFLOW_BACKOFF_TIMER
// Visibility
case *tasks.StartExecutionVisibilityTask:
taskType = enumsspb.TASK_TYPE_VISIBILITY_START_EXECUTION
case *tasks.UpsertExecutionVisibilityTask:
taskType = enumsspb.TASK_TYPE_VISIBILITY_UPSERT_EXECUTION
case *tasks.CloseExecutionVisibilityTask:
taskType = enumsspb.TASK_TYPE_VISIBILITY_CLOSE_EXECUTION
case *tasks.DeleteExecutionVisibilityTask:
taskType = enumsspb.TASK_TYPE_VISIBILITY_DELETE_EXECUTION
default:
return 0, serviceerror.NewInternal(fmt.Sprintf("Unknown timer task type: %v", task))
return 0, serviceerror.NewInternal(fmt.Sprintf("Unknown task type: %v", task))
}

return taskType, nil
Expand Down

0 comments on commit fb8a5e0

Please sign in to comment.