如何在公牛队列中进行无限尝试?



>我正在尝试在用户在我的网站上注册后发送电子邮件

我当前的代码如下所示

const data = {
from: 'no-reply@test.com',
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)

如何将尝试设置为无限?

在生产者中,在创建新任务时设置尝试

const taskOpts = {
attempts: Number.MAX_SAFE_INTEGER,
}
Client.add(taskType, taskData, taskOpts)

相关内容

  • 没有找到相关文章

最新更新