lykmapipo / kue-scheduler

A job scheduler utility for kue, backed by redis and built for node.js
246 stars 47 forks source link

this._scheduler.pttl is not a function since August 3rd update #104

Open Cbenh opened 6 years ago

Cbenh commented 6 years ago

Hi, i got this issue since the update of the node module yesterday. The setup was a simple job running every 2 minutes. Works great before. Thanks

TypeError: this._scheduler.pttl is not a function at Queue.isKeyExpired (/var/www/api/node_modules/kue-scheduler/index.js:230:23)

samhunta commented 6 years ago

My bad 😨

samhunta commented 6 years ago

What did this function do before?

Cbenh commented 6 years ago

I'm not using it directly. This is my config.

const kue = require('kue-scheduler');

const Queue = kue.createQueue({
  prefix: 'kue',
  redis: {
    port: '6379',
    host: 'localhost'
  }
});

Queue.process('job1', function (job, done) {
    console.log(job);
      done && done(null, "success");
  });

Queue.on('schedule success', function (job) {
    job.on('complete', function (result) {
       console.log('Job completed with data ', result);
    }).on('failed attempt', function (errorMessage, doneAttempts) {
       console.log('Job failed');
    }).on('failed', function (errorMessage) {
       console.log('Job failed');
    }).on('progress', function (progress, data) {
      console.log('\r  job #' + job.id + ' ' + progress +
         '% complete with data ', data);
    });
  });

  Queue.every('2 minutes', job1);