I have stuck all the jobs in active state due to app crash.
How can we query all the active job in Kue and change back to inactive state programmicatlly?
Thanks a lot
Kit
Something like this:
jobs.active( function( err, ids ) {
ids.forEach( function( id ) {
Job.get( id, function( err, job ) {
job.inactive();
}
}
});
Yes. Got it Thanks a lot.
var kue = require('kue');
var jobs = kue.createQueue({
prefix: 'kue',
redis: {
port: options.port,
host: options.host,
auth: options.password
}
});
// Restart the server , change all active job into active
jobs.active( function( err, ids ) {
ids.forEach( function( id ) {
kue.Job.get( id, function( err, job ) {
job.inactive();
});
});
});
It should be like that.
@kithokit Please remember to put your codes in related github markups, I did it for you this time ;)
Ok. Thanks a lot!
Thanks @behrad!