diff --git a/src/client/app/admin/views/queue.vue b/src/client/app/admin/views/queue.vue index 43a41ffbe..9aa740c68 100644 --- a/src/client/app/admin/views/queue.vue +++ b/src/client/app/admin/views/queue.vue @@ -48,14 +48,15 @@ -
+
{{ job.id }} + {{ `(${job.attempts}/${job.maxAttempts}, ${Math.floor((jobsFetched - job.timestamp) / 1000 / 60)}min)` }}
{{ $t('result-is-truncated', { n: jobsLimit }) }} @@ -84,6 +85,7 @@ export default Vue.extend({ chartLimit: 200, jobs: [], jobsLimit: 50, + jobsFetched: Date.now(), domain: 'deliver', state: 'delayed', faTasks, faPaperPlane, faInbox, faChartBar, faDatabase, faCloud @@ -140,6 +142,7 @@ export default Vue.extend({ state: this.state, limit: this.jobsLimit }).then(jobs => { + this.jobsFetched = Date.now(), this.jobs = jobs; }); }, @@ -149,7 +152,8 @@ export default Vue.extend({ diff --git a/src/server/api/endpoints/admin/queue/jobs.ts b/src/server/api/endpoints/admin/queue/jobs.ts index 4e4777569..0d23ca3e5 100644 --- a/src/server/api/endpoints/admin/queue/jobs.ts +++ b/src/server/api/endpoints/admin/queue/jobs.ts @@ -1,6 +1,6 @@ import $ from 'cafy'; import define from '../../../define'; -import { deliverQueue, inboxQueue } from '../../../../../queue'; +import { deliverQueue, inboxQueue, dbQueue, objectStorageQueue } from '../../../../../queue'; export const meta = { tags: ['admin'], @@ -10,11 +10,11 @@ export const meta = { params: { domain: { - validator: $.str, + validator: $.str.or(['deliver', 'inbox', 'db', 'objectStorage']), }, state: { - validator: $.str, + validator: $.str.or(['active', 'waiting', 'delayed']), }, limit: { @@ -28,13 +28,22 @@ 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 => ({ - id: job.id, - data: job.data, - attempts: job.attemptsMade, - })); + 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, + }; + }); });