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

45 lines
944 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: {
ref: 'QueueCount'
},
inbox: {
ref: 'QueueCount'
},
db: {
ref: 'QueueCount'
},
objectStorage: {
ref: 'QueueCount'
}
}
}
};
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,
};
});