node-schedule: 【Bug】schedule.scheduleJob executed twice
AWS Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-116-generic x86_64) node: v8.11.1 node-schedule: 1.2.4
my code:
// Everyday 0:00, generater new tasks
const rule = new schedule.RecurrenceRule();
rule.hour = 0;
rule.minute = 0;
rule.second = 0;
schedule.scheduleJob(rule, () => {
console.log('Recurrence job start');
getTaskRules();
});
my log:
Previous log is ok too!
server no restart, no error:
I have encountered this problem a few months ago, I just restarted the server, it works fine! but now,it is coming again!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 21 (4 by maintainers)
I’m using pm2 and facing schedule.scheduleJob runs twice, so what should I do for run it single time.
If you used PM2, because PM2 is used to start two processes。
I update to 1.3.0 and it had worked fine for a few months.
@yousefissa there’s an easy way to determine this. If you run
killall -9 node
all node apps will die. There you can start your app again. If you see double treatment the issue might be other than multiple processes “console.logging” to the same stdout (in my case the same window console).@HuMoran there was an issue fixed in
1.3.0
. Can you check if using1.3.0
works for your case?In the meantime I’ll look into @mreis1 issue