diff --git a/example/bullmq.js b/example/bullmq.js index 001423f3..1c1c438e 100644 --- a/example/bullmq.js +++ b/example/bullmq.js @@ -1,5 +1,5 @@ const Arena = require('../'); -const {Queue, QueueScheduler, Worker, FlowProducer} = require('bullmq'); +const {Queue, Worker, FlowProducer} = require('bullmq'); const RedisServer = require('redis-server'); // Select ports that are unlikely to be used by other services a developer might be running locally. @@ -14,11 +14,6 @@ async function main() { const queueName = 'name_of_my_queue'; const parentQueueName = 'name_of_my_parent_queue'; - const queueScheduler = new QueueScheduler(queueName, { - connection: {port: REDIS_SERVER_PORT}, - }); - await queueScheduler.waitUntilReady(); - const queue = new Queue(queueName, { connection: {port: REDIS_SERVER_PORT}, }); @@ -44,6 +39,7 @@ async function main() { } }, { + concurrency: 3, connection: {port: REDIS_SERVER_PORT}, } ); diff --git a/example/package.json b/example/package.json index 4417b107..ed4b0672 100644 --- a/example/package.json +++ b/example/package.json @@ -15,7 +15,7 @@ "dependencies": { "bee-queue": "^1.4.0", "bull": "^3.22.6", - "bullmq": "^1.34.0", + "bullmq": "^3.0.0", "express": "^4.17.1", "redis-server": "^1.2.2" } diff --git a/src/server/views/dashboard/queueJobsByState.js b/src/server/views/dashboard/queueJobsByState.js index 3bc72581..ba1f1448 100644 --- a/src/server/views/dashboard/queueJobsByState.js +++ b/src/server/views/dashboard/queueJobsByState.js @@ -59,7 +59,7 @@ async function _json(req, res) { const words = state.split('-'); const finalStateName = words.map((word) => _.capitalize(word)).join(''); jobs = await queue[`get${finalStateName}`](0, 1000); - jobs = jobs.map((j) => j.toJSON()); + jobs = jobs.map((j) => j && j.toJSON()); } const filename = `${queueName}-${state}-dump.json`; @@ -125,13 +125,21 @@ async function _html(req, res) { jobs = await queue.getJobs(stateTypes, startId, endId, order === 'asc'); } - for (const job of jobs) { - const jobState = queue.IS_BEE ? job.status : await job.getState(); - job.showRetryButton = !queue.IS_BEE || jobState === 'failed'; - job.retryButtonText = jobState === 'failed' ? 'Retry' : 'Trigger'; - job.showPromoteButton = !queue.IS_BEE && jobState === 'delayed'; - job.showDeleteRepeatableButton = queue.IS_BULL && job.opts.repeat; - job.parent = JobHelpers.getKeyProperties(job.parentKey); + for (let i = 0; i < jobs.length; i++) { + if (!jobs[i]) { + jobs[i] = { + showRetryButton: false, + showPromoteButton: false, + showDeleteRepeatableButton: false, + }; + } else { + const jobState = queue.IS_BEE ? jobs[i].status : await jobs[i].getState(); + jobs[i].showRetryButton = !queue.IS_BEE || jobState === 'failed'; + jobs[i].retryButtonText = jobState === 'failed' ? 'Retry' : 'Trigger'; + jobs[i].showPromoteButton = !queue.IS_BEE && jobState === 'delayed'; + jobs[i].showDeleteRepeatableButton = queue.IS_BULL && jobs[i].opts.repeat; + jobs[i].parent = JobHelpers.getKeyProperties(jobs[i].parentKey); + } } let pages = _.range(page - 6, page + 7).filter((page) => page >= 1); diff --git a/src/server/views/dashboard/templates/queueJobsByState.hbs b/src/server/views/dashboard/templates/queueJobsByState.hbs index 99ded832..ca7a757a 100644 --- a/src/server/views/dashboard/templates/queueJobsByState.hbs +++ b/src/server/views/dashboard/templates/queueJobsByState.hbs @@ -136,7 +136,9 @@