How to do infinite attempts in Bull Queue?

1.9k views Asked by At

I am trying to send a user email after he registeres on my website

My current code looks like this

const data = {
      from: '[email protected]',
      to: req.user.email,
      subject: 'Please reset your Test Account Password',
      text:
        'This is a test email to ask you to reset your Test Account Password. Good luck :)',
    }
    const options = {
      attempts: 1000,
      backoff: { type: 'exponential', delay: 30000 },
      removeOnComplete: true,
    }
    sendMailQueue.add('resetEmail', data, options)

How do I set the attempts to INFINITE?

1

There are 1 answers

0
JBB On

In producer, set attempts while creating new task

const taskOpts = {
    attempts: Number.MAX_SAFE_INTEGER,
}

Client.add(taskType, taskData, taskOpts)