2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-12 11:37:45 +09:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
*/
|
|
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
2022-12-04 10:16:03 +09:00
|
|
|
import type { DbQueue, DeliverQueue, EndedPollNotificationQueue, InboxQueue, ObjectStorageQueue, SystemQueue, WebhookDeliverQueue } from '@/core/QueueModule.js';
|
2019-03-08 13:03:38 +09:00
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
2022-01-18 22:27:10 +09:00
|
|
|
requireCredential: true,
|
2019-03-08 13:03:38 +09:00
|
|
|
requireModerator: true,
|
2023-12-27 15:08:59 +09:00
|
|
|
kind: 'read:admin:emoji',
|
2019-03-08 13:03:38 +09:00
|
|
|
|
2021-03-06 22:34:11 +09:00
|
|
|
res: {
|
2022-01-18 22:27:10 +09:00
|
|
|
type: 'object',
|
|
|
|
|
optional: false, nullable: false,
|
2021-03-06 22:34:11 +09:00
|
|
|
properties: {
|
|
|
|
|
deliver: {
|
2022-01-18 22:27:10 +09:00
|
|
|
optional: false, nullable: false,
|
2021-12-09 23:58:30 +09:00
|
|
|
ref: 'QueueCount',
|
2021-03-06 22:34:11 +09:00
|
|
|
},
|
|
|
|
|
inbox: {
|
2022-01-18 22:27:10 +09:00
|
|
|
optional: false, nullable: false,
|
2021-12-09 23:58:30 +09:00
|
|
|
ref: 'QueueCount',
|
2021-03-06 22:34:11 +09:00
|
|
|
},
|
|
|
|
|
db: {
|
2022-01-18 22:27:10 +09:00
|
|
|
optional: false, nullable: false,
|
2021-12-09 23:58:30 +09:00
|
|
|
ref: 'QueueCount',
|
2021-03-06 22:34:11 +09:00
|
|
|
},
|
|
|
|
|
objectStorage: {
|
2022-01-18 22:27:10 +09:00
|
|
|
optional: false, nullable: false,
|
2021-12-09 23:58:30 +09:00
|
|
|
ref: 'QueueCount',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-01-18 22:27:10 +09:00
|
|
|
} as const;
|
2019-03-08 13:03:38 +09:00
|
|
|
|
2022-02-20 13:15:40 +09:00
|
|
|
export const paramDef = {
|
2022-02-19 14:05:32 +09:00
|
|
|
type: 'object',
|
|
|
|
|
properties: {},
|
|
|
|
|
required: [],
|
|
|
|
|
} as const;
|
|
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
@Injectable()
|
2023-08-17 21:20:58 +09:00
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
2022-09-18 03:27:08 +09:00
|
|
|
constructor(
|
|
|
|
|
@Inject('queue:system') public systemQueue: SystemQueue,
|
|
|
|
|
@Inject('queue:endedPollNotification') public endedPollNotificationQueue: EndedPollNotificationQueue,
|
|
|
|
|
@Inject('queue:deliver') public deliverQueue: DeliverQueue,
|
|
|
|
|
@Inject('queue:inbox') public inboxQueue: InboxQueue,
|
|
|
|
|
@Inject('queue:db') public dbQueue: DbQueue,
|
|
|
|
|
@Inject('queue:objectStorage') public objectStorageQueue: ObjectStorageQueue,
|
|
|
|
|
@Inject('queue:webhookDeliver') public webhookDeliverQueue: WebhookDeliverQueue,
|
|
|
|
|
) {
|
|
|
|
|
super(meta, paramDef, async (ps, me) => {
|
|
|
|
|
const deliverJobCounts = await this.deliverQueue.getJobCounts();
|
|
|
|
|
const inboxJobCounts = await this.inboxQueue.getJobCounts();
|
|
|
|
|
const dbJobCounts = await this.dbQueue.getJobCounts();
|
|
|
|
|
const objectStorageJobCounts = await this.objectStorageQueue.getJobCounts();
|
2019-03-08 13:03:38 +09:00
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
return {
|
|
|
|
|
deliver: deliverJobCounts,
|
|
|
|
|
inbox: inboxJobCounts,
|
|
|
|
|
db: dbJobCounts,
|
|
|
|
|
objectStorage: objectStorageJobCounts,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|