Bull: Builtin backoff strategies not explained in documentation

Created on 4 Jun 2020  路  7Comments  路  Source: OptimalBits/bull

Description

Builtin backoff strategies "fixed" and "exponential" are mentioned in the docs but not explained, what those strategies are doing ? Can it be combined with attempts option ?

Thanks

BETTER DOC

All 7 comments

yes attempts can be used with backoff strategies.

Builtin backoff strategies "fixed" and "exponential" are mentioned in the docs but not explained, what those strategies are doing ?

Trying to figure out too how backoff's work. They do not seem to do anything.
The code below just does two attempts right after each other. No backoff.

 queue.add({ data }, {
    timeout: 10000,
    attempts: 2,
    removeOnComplete: true,
    removeOnFail: true,
    backoff: {
      type: 'fixed',
      delay: 5000 // ms
    }
  })

Until the documentation is up to date I recommend you to check the tests for reference: https://github.com/taskforcesh/bullmq/blob/master/src/test/test_worker.ts#L1058

@tnolet I currently use fixed backoff with delay in production and it works well:

queue.add({ data }, { attempts: 5, backoff: { type: 'fixed', delay: 30000, // 30s } })

5 attempts with 30sec between each try. I still don't know what's the difference between fixed and exponential tho.

Suppose your worker throws error, and the job fails, does removeOnFail: false, keep the job in the queue?
I have

queue.add({ data }, {
    removeOnComplete: true,
    removeOnFail: false,
  })

It removes the jobs whatsoever.

@mythio please do not ask unrelated questions in the issues. You have already asked the same thing in three different places.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joe-at-startupmedia picture joe-at-startupmedia  路  3Comments

alolis picture alolis  路  4Comments

inn0vative1 picture inn0vative1  路  4Comments

ianstormtaylor picture ianstormtaylor  路  4Comments

davedbase picture davedbase  路  3Comments