mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-09-16 19:51:38 +08:00
Add run retry task, run scheduled task functionality
This commit is contained in:
@@ -35,6 +35,8 @@ import {
|
||||
RUN_ALL_RETRY_TASKS_SUCCESS,
|
||||
RUN_ALL_SCHEDULED_TASKS_SUCCESS,
|
||||
RUN_DEAD_TASK_SUCCESS,
|
||||
RUN_RETRY_TASK_SUCCESS,
|
||||
RUN_SCHEDULED_TASK_SUCCESS,
|
||||
TasksActionTypes,
|
||||
} from "../actions/tasksActions";
|
||||
import { DailyStat, Queue } from "../api";
|
||||
@@ -163,6 +165,40 @@ function queuesReducer(
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_SCHEDULED_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
pending: queueInfo.currentStats.pending + 1,
|
||||
scheduled: queueInfo.currentStats.scheduled - 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_RETRY_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
return queueInfo;
|
||||
}
|
||||
return {
|
||||
...queueInfo,
|
||||
currentStats: {
|
||||
...queueInfo.currentStats,
|
||||
pending: queueInfo.currentStats.pending + 1,
|
||||
retry: queueInfo.currentStats.retry - 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
}
|
||||
|
||||
case RUN_DEAD_TASK_SUCCESS: {
|
||||
const newData = state.data.map((queueInfo) => {
|
||||
if (queueInfo.name !== action.queue) {
|
||||
|
@@ -19,6 +19,8 @@ import {
|
||||
RUN_ALL_RETRY_TASKS_SUCCESS,
|
||||
RUN_ALL_SCHEDULED_TASKS_SUCCESS,
|
||||
RUN_DEAD_TASK_SUCCESS,
|
||||
RUN_RETRY_TASK_SUCCESS,
|
||||
RUN_SCHEDULED_TASK_SUCCESS,
|
||||
TasksActionTypes,
|
||||
} from "../actions/tasksActions";
|
||||
|
||||
@@ -45,6 +47,20 @@ function snackbarReducer(
|
||||
isOpen: false,
|
||||
};
|
||||
|
||||
case RUN_SCHEDULED_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
// TODO: show only task id
|
||||
message: `Scheduled task ${action.taskKey} is now pending`,
|
||||
};
|
||||
|
||||
case RUN_RETRY_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
// TODO: show only task id
|
||||
message: `Retry task ${action.taskKey} is now pending`,
|
||||
};
|
||||
|
||||
case RUN_DEAD_TASK_SUCCESS:
|
||||
return {
|
||||
isOpen: true,
|
||||
|
@@ -66,6 +66,12 @@ import {
|
||||
RUN_ALL_SCHEDULED_TASKS_SUCCESS,
|
||||
DELETE_ALL_SCHEDULED_TASKS_BEGIN,
|
||||
RUN_ALL_SCHEDULED_TASKS_BEGIN,
|
||||
RUN_RETRY_TASK_BEGIN,
|
||||
RUN_RETRY_TASK_SUCCESS,
|
||||
RUN_RETRY_TASK_ERROR,
|
||||
RUN_SCHEDULED_TASK_BEGIN,
|
||||
RUN_SCHEDULED_TASK_SUCCESS,
|
||||
RUN_SCHEDULED_TASK_ERROR,
|
||||
} from "../actions/tasksActions";
|
||||
import {
|
||||
ActiveTask,
|
||||
@@ -389,6 +395,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_SCHEDULED_TASK_BEGIN:
|
||||
case DELETE_SCHEDULED_TASK_BEGIN:
|
||||
return {
|
||||
...state,
|
||||
@@ -403,6 +410,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_SCHEDULED_TASK_SUCCESS:
|
||||
case DELETE_SCHEDULED_TASK_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
@@ -414,6 +422,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_SCHEDULED_TASK_ERROR:
|
||||
case DELETE_SCHEDULED_TASK_ERROR:
|
||||
return {
|
||||
...state,
|
||||
@@ -525,6 +534,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_RETRY_TASK_BEGIN:
|
||||
case DELETE_RETRY_TASK_BEGIN:
|
||||
return {
|
||||
...state,
|
||||
@@ -539,6 +549,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_RETRY_TASK_SUCCESS:
|
||||
case DELETE_RETRY_TASK_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
@@ -550,6 +561,7 @@ function tasksReducer(
|
||||
},
|
||||
};
|
||||
|
||||
case RUN_RETRY_TASK_ERROR:
|
||||
case DELETE_RETRY_TASK_ERROR:
|
||||
return {
|
||||
...state,
|
||||
|
Reference in New Issue
Block a user