Files
misskey/src/server/api/endpoints/admin/queue/stats.ts
T

50 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-03-24 11:26:51 +09:00
import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues';
2019-03-08 13:03:38 +09:00
import define from '../../../define';
export const meta = {
2021-03-06 22:34:11 +09:00
desc: {
'ja-JP': 'キューの状態を返します。',
'en-US': 'Returns the status of the queue.'
},
2019-03-08 13:03:38 +09:00
tags: ['admin'],
2020-02-15 21:33:32 +09:00
requireCredential: true as const,
2019-03-08 13:03:38 +09:00
requireModerator: true,
2021-03-06 22:34:11 +09:00
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'
}
}
}
2019-03-08 13:03:38 +09:00
};
export default define(meta, async (ps) => {
const deliverJobCounts = await deliverQueue.getJobCounts();
2019-03-08 21:30:12 +09:00
const inboxJobCounts = await inboxQueue.getJobCounts();
2019-05-27 17:44:51 +09:00
const dbJobCounts = await dbQueue.getJobCounts();
const objectStorageJobCounts = await objectStorageQueue.getJobCounts();
2019-03-08 13:03:38 +09:00
return {
deliver: deliverJobCounts,
2019-05-27 17:44:51 +09:00
inbox: inboxJobCounts,
db: dbJobCounts,
objectStorage: objectStorageJobCounts,
2019-03-08 13:03:38 +09:00
};
});