mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-07 20:52:02 +08:00
Add cancel action to ActiveTasksTable
This commit is contained in:
@@ -41,6 +41,11 @@ export interface ListSchedulerEntriesResponse {
|
||||
entries: SchedulerEntry[];
|
||||
}
|
||||
|
||||
export interface BatchCancelTasksResponse {
|
||||
canceled_ids: string[];
|
||||
error_ids: string[];
|
||||
}
|
||||
|
||||
export interface BatchDeleteTasksResponse {
|
||||
deleted_keys: string[];
|
||||
failed_keys: string[];
|
||||
@@ -198,6 +203,27 @@ export async function cancelActiveTask(
|
||||
});
|
||||
}
|
||||
|
||||
export async function cancelAllActiveTasks(qname: string): Promise<void> {
|
||||
await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/active_tasks:cancel_all`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function batchCancelActiveTasks(
|
||||
qname: string,
|
||||
taskIds: string[]
|
||||
): Promise<BatchCancelTasksResponse> {
|
||||
const resp = await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/active_tasks:batch_cancel`,
|
||||
data: {
|
||||
task_ids: taskIds,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
export async function listPendingTasks(
|
||||
qname: string,
|
||||
pageOpts?: PaginationOptions
|
||||
|
Reference in New Issue
Block a user