node-schedule / node-schedule

A cron-like and not-cron-like job scheduler for Node.
MIT License
9.11k stars 513 forks source link

Job does nor run as expected #452

Closed rols2015 closed 5 years ago

rols2015 commented 6 years ago

I set a rule to run my job every 10 mins, but seems it's not running as expected. I would say it runs randomly each 20 or 30 sometimes 40 mins. Can someone advice what is wrong? Is it a bug?


//Sheduler
var cron = require('node-schedule');
var rule = new cron.RecurrenceRule();
rule.minute = 10;
cron.scheduleJob(rule, function(){
console.log(new Date(), 'Profile Update Job run!');

});
rols2015 commented 6 years ago

But when I use


cron.scheduleJob('0 /10 * * * *', function(){

  console.log(new Date(), 'Profile Update Job run!');

});```

it works fine
santigimeno commented 5 years ago

With recurrence rules you should use: js rule.minute: [ 0, 10, 20, 30, 40, 50 ]