Bull: Backoff not working

Created on 18 Jan 2019  路  4Comments  路  Source: OptimalBits/bull

Description

When running Bull and provide backoff as per the documentation here I can't seem to get the backoff to trigger despite what I do.

I've created a minimal version:

const Queue = require('bull');
const jobData = {
    "data": {
        "comment": "data for job goes here"
    },
    "options": {
        "delay": 0,
        "backoff": {
            "type": "exponential",
            "delay": 100
        }
    }
};


const callbackQueue = new Queue('callback');


callbackQueue.process(function(job, done) {
    console.log('MEOW');
    done(new Error('Backoff occur'));
});


callbackQueue.add(jobData['data'], jobData['options']);

As you'd expect, the MEOW should occur over-and-over ; however, it will only occur once

Bull version

"bull": "3.5.2",

Additional information

OS: Windows 10

BETTER DOC

Most helpful comment

@nihalmpatel the difference is in how the delay between retries is calculated. In fixed it is always the same delay, in exponential it increases exponentially.

All 4 comments

Looks like the issue was the fact that if attempts in the job was not specified it defaulted to 1 and despite a backoff being supplied, won't rerun because the "max attempts" (of one) have been exceeded.

Maybe update the docs to reflect this?

@Jujunol the backoff setting only specifies how to handle the retries, but it will only retry as you discovered, the number of times specified in attempts.

@manast So, what's the difference between fixed and exponential in backoff setting?

@nihalmpatel the difference is in how the delay between retries is calculated. In fixed it is always the same delay, in exponential it increases exponentially.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamsoffer picture adamsoffer  路  4Comments

rodrigoords picture rodrigoords  路  4Comments

DevBrent picture DevBrent  路  4Comments

pintocarlos picture pintocarlos  路  3Comments

PhillippOhlandt picture PhillippOhlandt  路  4Comments