kue invalid job makes nodejs dump

211 Views Asked by At

kue throwed the err:

content:  Error: job "121308" is invalid

And nodejs app exited unexpected. I referenced to the code and had no idea with the reason.

/**
 * Get job with `id` and callback `fn(err, job)`.
 *
 * @param {Number} id
 * @param {String} jobType is optional
 * @param {Function} fn
 * @api public
 */

exports.get = function( id, jobType, fn ) {
  if (id === null || id === undefined) {
    return fn(new Error('invalid id param'));
  }
  if (typeof jobType === 'function' && !fn) {
    fn = jobType;
    jobType = '';
  }
  var client = redis.client()
    , job    = new Job;

  job.id = id;
  job.zid = client.createFIFO(id);
  client.hgetall(client.getKey('job:' + job.id), function( err, hash ) {
    if( err ) return fn(err);
    if( !hash ) {
      exports.removeBadJob(job.id, jobType);
      return fn(new Error('job "' + job.id + '" doesnt exist'));
    }
    if( !hash.type ) {
      exports.removeBadJob(job.id, jobType);
      return fn(new Error('job "' + job.id + '" is invalid'))
    }
.....
 

Anybody came into this issue?

ref: https://github.com/Automattic/kue

0

There are 0 best solutions below