summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/admin/queue/jobs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/endpoints/admin/queue/jobs.ts')
-rw-r--r--src/server/api/endpoints/admin/queue/jobs.ts81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/server/api/endpoints/admin/queue/jobs.ts b/src/server/api/endpoints/admin/queue/jobs.ts
deleted file mode 100644
index c426e5f39b..0000000000
--- a/src/server/api/endpoints/admin/queue/jobs.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '@/queue/queues';
-import $ from 'cafy';
-import define from '../../../define';
-
-export const meta = {
- tags: ['admin'],
-
- requireCredential: true as const,
- requireModerator: true,
-
- params: {
- domain: {
- validator: $.str.or(['deliver', 'inbox', 'db', 'objectStorage']),
- },
-
- state: {
- validator: $.str.or(['active', 'waiting', 'delayed']),
- },
-
- limit: {
- validator: $.optional.num,
- default: 50
- },
- },
-
- res: {
- type: 'array' as const,
- optional: false as const, nullable: false as const,
- items: {
- type: 'object' as const,
- optional: false as const, nullable: false as const,
- properties: {
- id: {
- type: 'string' as const,
- optional: false as const, nullable: false as const,
- format: 'id'
- },
- data: {
- type: 'object' as const,
- optional: false as const, nullable: false as const
- },
- attempts: {
- type: 'number' as const,
- optional: false as const, nullable: false as const
- },
- maxAttempts: {
- type: 'number' as const,
- optional: false as const, nullable: false as const
- },
- timestamp: {
- type: 'number' as const,
- optional: false as const, nullable: false as const
- }
- }
- }
- }
-};
-
-export default define(meta, async (ps) => {
- const queue =
- ps.domain === 'deliver' ? deliverQueue :
- ps.domain === 'inbox' ? inboxQueue :
- ps.domain === 'db' ? dbQueue :
- ps.domain === 'objectStorage' ? objectStorageQueue :
- null as never;
-
- const jobs = await queue.getJobs([ps.state], 0, ps.limit!);
-
- return jobs.map(job => {
- const data = job.data;
- delete data.content;
- delete data.user;
- return {
- id: job.id,
- data,
- attempts: job.attemptsMade,
- maxAttempts: job.opts ? job.opts.attempts : 0,
- timestamp: job.timestamp,
- };
- });
-});