Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js Kue how to restart failed jobs

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 the id of a job manually from the the list of failed jobs to the list of inactive jobs using redis commands.

Is this possible using kue?

I don't want to set a fixed number of retry attempts - I just want to retry specific jobs.

Suggestions for a well maintained alternative to kue are also welcome.

like image 871
Matthias Avatar asked Jan 11 '13 15:01

Matthias


People also ask

How do I restart a node JS project?

If it's just running (not a daemon) then just use Ctrl-C.

How do I start stop restarting a node js server process?

js Automatic restart Node. js server with nodemon. In this case, if we make any changes to the project then we will have to restart the server by killing it using CTRL+C and then typing the same command again.

How do you prevent nodes?

You can start a node by using the startNode command. You can stop a node by using the stopNode command.


1 Answers

i dont know if this is working but you could try to reset the state of the job to active, and save the job again:

job.on('failed', function() {
  job.state('inactive').save();

Edit: setting state to inactive will correctly re-enqueue the task.

like image 163
hereandnow78 Avatar answered Oct 01 '22 04:10

hereandnow78