Skip to content

Instantly share code, notes, and snippets.

@ericsaboia
Created September 11, 2014 15:49
Show Gist options
  • Save ericsaboia/33b814705b6dc0e87972 to your computer and use it in GitHub Desktop.
Save ericsaboia/33b814705b6dc0e87972 to your computer and use it in GitHub Desktop.
Reactivate kue jobs passing a type
var kue = require('kue');
var jobs = kue.createQueue();
console.log('Restarting job ' + process.argv[2]);
jobs.state(process.argv[2], function (err, ids) {
ids.forEach(reactivate);
});
function reactivate (id) {
kue.Job.get(id, function(err, job) {
console.log(id);
job.inactive();
});
}
@phektus
Copy link

phektus commented Dec 2, 2014

Don't forget to pass on the config object in createQueue() if you have one.

    var jobs = kue.createQueue({ your:config });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment