mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
Remove stale code
This commit is contained in:
parent
93e42bd9f0
commit
3d982d9a8b
@ -1,7 +1,5 @@
|
||||
import {
|
||||
deleteQueue,
|
||||
getQueue,
|
||||
GetQueueResponse,
|
||||
listQueues,
|
||||
ListQueuesResponse,
|
||||
pauseQueue,
|
||||
@ -12,9 +10,6 @@ import { Dispatch } from "redux";
|
||||
// List of queue related action types.
|
||||
export const LIST_QUEUES_BEGIN = "LIST_QUEUES_BEGIN";
|
||||
export const LIST_QUEUES_SUCCESS = "LIST_QUEUES_SUCCESS";
|
||||
export const GET_QUEUE_BEGIN = "GET_QUEUE_BEGIN";
|
||||
export const GET_QUEUE_SUCCESS = "GET_QUEUE_SUCCESS";
|
||||
export const GET_QUEUE_ERROR = "GET_QUEUE_ERROR";
|
||||
export const DELETE_QUEUE_BEGIN = "DELETE_QUEUE_BEGIN";
|
||||
export const DELETE_QUEUE_SUCCESS = "DELETE_QUEUE_SUCCESS";
|
||||
export const DELETE_QUEUE_ERROR = "DELETE_QUEUE_ERROR";
|
||||
@ -34,23 +29,6 @@ interface ListQueuesSuccessAction {
|
||||
payload: ListQueuesResponse;
|
||||
}
|
||||
|
||||
interface GetQueueBeginAction {
|
||||
type: typeof GET_QUEUE_BEGIN;
|
||||
queue: string; // name of the queue
|
||||
}
|
||||
|
||||
interface GetQueueSuccessAction {
|
||||
type: typeof GET_QUEUE_SUCCESS;
|
||||
queue: string; // name of the queue
|
||||
payload: GetQueueResponse;
|
||||
}
|
||||
|
||||
interface GetQueueErrorAction {
|
||||
type: typeof GET_QUEUE_ERROR;
|
||||
queue: string; // name of the queue
|
||||
error: string; // error description
|
||||
}
|
||||
|
||||
interface DeleteQueueBeginAction {
|
||||
type: typeof DELETE_QUEUE_BEGIN;
|
||||
queue: string; // name of the queue
|
||||
@ -103,9 +81,6 @@ interface ResumeQueueErrorAction {
|
||||
export type QueuesActionTypes =
|
||||
| ListQueuesBeginAction
|
||||
| ListQueuesSuccessAction
|
||||
| GetQueueBeginAction
|
||||
| GetQueueSuccessAction
|
||||
| GetQueueErrorAction
|
||||
| DeleteQueueBeginAction
|
||||
| DeleteQueueSuccessAction
|
||||
| DeleteQueueErrorAction
|
||||
@ -128,27 +103,6 @@ export function listQueuesAsync() {
|
||||
};
|
||||
}
|
||||
|
||||
export function getQueueAsync(qname: string) {
|
||||
return async (dispatch: Dispatch<QueuesActionTypes>) => {
|
||||
dispatch({ type: GET_QUEUE_BEGIN, queue: qname });
|
||||
try {
|
||||
const response = await getQueue(qname);
|
||||
dispatch({
|
||||
type: GET_QUEUE_SUCCESS,
|
||||
queue: qname,
|
||||
payload: response,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
dispatch({
|
||||
type: GET_QUEUE_ERROR,
|
||||
queue: qname,
|
||||
error: `Could not retrieve queue data for queue: ${qname}`,
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function deleteQueueAsync(qname: string) {
|
||||
return async (dispatch: Dispatch<QueuesActionTypes>) => {
|
||||
dispatch({
|
||||
|
@ -7,11 +7,6 @@ export interface ListQueuesResponse {
|
||||
queues: Queue[];
|
||||
}
|
||||
|
||||
export interface GetQueueResponse {
|
||||
current: Queue;
|
||||
history: DailyStat[];
|
||||
}
|
||||
|
||||
export interface ListActiveTasksResponse {
|
||||
tasks: ActiveTask[];
|
||||
stats: Queue;
|
||||
@ -158,14 +153,6 @@ export async function listQueues(): Promise<ListQueuesResponse> {
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
export async function getQueue(qname: string): Promise<GetQueueResponse> {
|
||||
const resp = await axios({
|
||||
method: "get",
|
||||
url: `${BASE_URL}/queues/${qname}`,
|
||||
});
|
||||
return resp.data;
|
||||
}
|
||||
|
||||
export async function deleteQueue(qname: string): Promise<void> {
|
||||
await axios({
|
||||
method: "delete",
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
RESUME_QUEUE_BEGIN,
|
||||
RESUME_QUEUE_ERROR,
|
||||
RESUME_QUEUE_SUCCESS,
|
||||
GET_QUEUE_SUCCESS,
|
||||
DELETE_QUEUE_BEGIN,
|
||||
DELETE_QUEUE_ERROR,
|
||||
DELETE_QUEUE_SUCCESS,
|
||||
@ -45,7 +44,7 @@ import {
|
||||
RUN_SCHEDULED_TASK_SUCCESS,
|
||||
TasksActionTypes,
|
||||
} from "../actions/tasksActions";
|
||||
import { DailyStat, Queue } from "../api";
|
||||
import { Queue } from "../api";
|
||||
|
||||
interface QueuesState {
|
||||
loading: boolean;
|
||||
@ -55,7 +54,6 @@ interface QueuesState {
|
||||
export interface QueueInfo {
|
||||
name: string; // name of the queue.
|
||||
currentStats: Queue;
|
||||
history: DailyStat[];
|
||||
requestPending: boolean; // indicates pause/resume/delete action is pending on this queue
|
||||
}
|
||||
|
||||
@ -77,22 +75,10 @@ function queuesReducer(
|
||||
data: queues.map((q: Queue) => ({
|
||||
name: q.queue,
|
||||
currentStats: q,
|
||||
history: [],
|
||||
requestPending: false,
|
||||
})),
|
||||
};
|
||||
|
||||
case GET_QUEUE_SUCCESS:
|
||||
const newData = state.data
|
||||
.filter((queueInfo) => queueInfo.name !== action.queue)
|
||||
.concat({
|
||||
name: action.queue,
|
||||
currentStats: action.payload.current,
|
||||
history: action.payload.history,
|
||||
requestPending: false,
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
|
||||
case DELETE_QUEUE_BEGIN:
|
||||
case PAUSE_QUEUE_BEGIN:
|
||||
case RESUME_QUEUE_BEGIN: {
|
||||
@ -165,7 +151,6 @@ function queuesReducer(
|
||||
.concat({
|
||||
name: action.queue,
|
||||
currentStats: action.payload.stats,
|
||||
history: [],
|
||||
requestPending: false,
|
||||
});
|
||||
return { ...state, data: newData };
|
||||
|
Loading…
Reference in New Issue
Block a user