mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-07 12:42:00 +08:00
Add kill functionality to scheduled and retry tasks table
This commit is contained in:
@@ -51,6 +51,11 @@ export interface BatchRunTasksResponse {
|
||||
error_keys: string[];
|
||||
}
|
||||
|
||||
export interface BatchKillTasksResponse {
|
||||
dead_keys: string[];
|
||||
error_keys: string[];
|
||||
}
|
||||
|
||||
export interface Queue {
|
||||
queue: string;
|
||||
paused: boolean;
|
||||
@@ -263,6 +268,16 @@ export async function runScheduledTask(
|
||||
});
|
||||
}
|
||||
|
||||
export async function killScheduledTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
): Promise<void> {
|
||||
await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/scheduled_tasks/${taskKey}:kill`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteScheduledTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
@@ -315,6 +330,27 @@ export async function runAllScheduledTasks(qname: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function batchKillScheduledTasks(
|
||||
qname: string,
|
||||
taskKeys: string[]
|
||||
): Promise<BatchKillTasksResponse> {
|
||||
const resp = await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:batch_kill`,
|
||||
data: {
|
||||
task_keys: taskKeys,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
export async function killAllScheduledTasks(qname: string): Promise<void> {
|
||||
await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/scheduled_tasks:kill_all`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function runRetryTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
@@ -325,6 +361,16 @@ export async function runRetryTask(
|
||||
});
|
||||
}
|
||||
|
||||
export async function killRetryTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
): Promise<void> {
|
||||
await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/retry_tasks/${taskKey}:kill`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteRetryTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
@@ -377,6 +423,27 @@ export async function runAllRetryTasks(qname: string): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function batchKillRetryTasks(
|
||||
qname: string,
|
||||
taskKeys: string[]
|
||||
): Promise<BatchKillTasksResponse> {
|
||||
const resp = await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/retry_tasks:batch_kill`,
|
||||
data: {
|
||||
task_keys: taskKeys,
|
||||
},
|
||||
});
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
export async function killAllRetryTasks(qname: string): Promise<void> {
|
||||
await axios({
|
||||
method: "post",
|
||||
url: `${BASE_URL}/queues/${qname}/retry_tasks:kill_all`,
|
||||
});
|
||||
}
|
||||
|
||||
export async function runDeadTask(
|
||||
qname: string,
|
||||
taskKey: string
|
||||
|
Reference in New Issue
Block a user