iceshrimp-legacy/packages/backend/src/server/api/endpoints/admin/queue/stats.ts

46 lines
1,004 B
TypeScript
Raw Normal View History

import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues';
import define from '../../../define';
export const meta = {
tags: ['admin'],
2020-02-15 13:33:32 +01:00
requireCredential: true as const,
requireModerator: true,
params: {},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
deliver: {
2021-12-09 15:58:30 +01:00
ref: 'QueueCount',
},
inbox: {
2021-12-09 15:58:30 +01:00
ref: 'QueueCount',
},
db: {
2021-12-09 15:58:30 +01:00
ref: 'QueueCount',
},
objectStorage: {
2021-12-09 15:58:30 +01:00
ref: 'QueueCount',
},
},
},
};
2022-01-02 18:12:50 +01:00
// eslint-disable-next-line import/no-default-export
export default define(meta, async (ps) => {
const deliverJobCounts = await deliverQueue.getJobCounts();
2019-03-08 13:30:12 +01:00
const inboxJobCounts = await inboxQueue.getJobCounts();
2019-05-27 10:44:51 +02:00
const dbJobCounts = await dbQueue.getJobCounts();
const objectStorageJobCounts = await objectStorageQueue.getJobCounts();
return {
deliver: deliverJobCounts,
2019-05-27 10:44:51 +02:00
inbox: inboxJobCounts,
db: dbJobCounts,
objectStorage: objectStorageJobCounts,
};
});