Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
I need to use the delay functionality. This change allows using the delay functionality of Bullmq. Tested it locally and it works. In addition it's also as described in the bullmq docs (https://docs.bullmq.io/guide/jobs/delayed)
  • Loading branch information
yanndebelgique committed Nov 19, 2020
1 parent f4b022f commit 2f930ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

'use strict'

const { Worker, Queue, QueueEvents } = require('bullmq')
const { Worker, Queue, QueueScheduler, QueueEvents } = require('bullmq')

module.exports = {
settings: {
Expand Down Expand Up @@ -56,6 +56,8 @@ module.exports = {
methods: {
$resolve(name) {
if (!this.$queueResolved[name]) {
// Adding QueueScheduler to support delayed jobs as described here https://docs.bullmq.io/guide/jobs/delayed
new QueueScheduler(name, { connection: this.$connection })
this.$queueResolved[name] = new Queue(name, { connection: this.$connection })
}
return this.$queueResolved[name]
Expand Down

0 comments on commit 2f930ea

Please sign in to comment.