54
}
55
56
>
resp, err := executionManager.GetHistoryTasks(ctx, &persistence.GetHistoryTasksRequest{
api.go
57
>
ShardID: adminRequest.ShardId,
58
>
TaskCategory: taskCategory,
59
>
InclusiveMinTaskKey: minTaskKey,
60
>
ExclusiveMaxTaskKey: maxTaskKey,
61
>
BatchSize: int(adminRequest.BatchSize),
62
>
NextPageToken: adminRequest.NextPageToken,
63
>
})
64
>
if err != nil {
65
return nil, err
66
}
67
68
>
return &historyservice.ListTasksResponse{
api.go
69
>
Response: &adminservice.ListHistoryTasksResponse{
70
>
Tasks: toAdminTask(resp.Tasks),
71
>
NextPageToken: resp.NextPageToken,
72
>
},
73
>
}, nil
74
}
75
76
>
func toAdminTask(historyTasks []tasks.Task) []*adminservice.Task {
api.go
77
>
var adminTasks []*adminservice.Task
78
>
for _, historyTask := range historyTasks {
79
>
historyTaskVersion := common.EmptyVersion
80
>
if taskWithVersion, ok := historyTask.(tasks.HasVersion); ok {
81
>
historyTaskVersion = taskWithVersion.GetVersion()
82
>
}
83
84
>
adminTasks = append(adminTasks, &adminservice.Task{
api.go
85
>
NamespaceId: historyTask.GetNamespaceID(),
86
>
WorkflowId: historyTask.GetWorkflowID(),
87
>
RunId: historyTask.GetRunID(),
88
>
TaskId: historyTask.GetTaskID(),
89
>
TaskType: historyTask.GetType(),
90
>
FireTime: timestamppb.New(historyTask.GetKey().FireTime),
91
>
Version: historyTaskVersion,
92
>
})
93
}
95
}