Node.js Kue how to restart failed jobs

后端 未结 3 985
孤独总比滥情好
孤独总比滥情好 2020-12-30 04:42

I am using kue for delayed jobs in my node.js application.

I have some problems to figure out how I can restart a job using the API of kue without having to move th

3条回答
  •  情书的邮戳
    2020-12-30 05:36

    see Failure Attempts in the official docs

    By default jobs only have one attempt, that is when they fail, they are marked as a failure, and remain that way until you intervene. However, Kue allows you to specify this, which is important for jobs such as transferring an email, which upon failure, may usually retry without issue. To do this invoke the .attempts() method with a number.

     queue.create('email', {
         title: 'welcome email for tj'
       , to: 'tj@learnboost.com'
       , template: 'welcome-email'
     }).priority('high').attempts(5).save();
    

    reference: failure attempts

提交回复
热议问题