Kue: How to query all the active jobs programatically?

Created on 24 Sep 2014  路  5Comments  路  Source: Automattic/kue

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

Documentation Question

All 5 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CMCDragonkai picture CMCDragonkai  路  4Comments

narainsagar picture narainsagar  路  8Comments

shriramshankar picture shriramshankar  路  8Comments

robert-irribarren picture robert-irribarren  路  3Comments

JperF picture JperF  路  8Comments