0

I'm using sashido AS parse server. I want to implement cron jobs in sashido which can call every 1 minute.

I have defined jobs.js file in cloud code(sashido) which contains below code.

const cron = require('node-cron');
var schedule = require('node-schedule');

cron.schedule("1 * * * * *", () => {    
  console.info('--Every Minutes-------', new Date());
});

When I deployed it to sashido it giving me this logs in logs file.

enter image description here

It showing me multiple logs at the same time. Please help me out of this stuff. Thanks in advance..

sam
  • 372
  • 2
  • 12

1 Answers1

0

The thing is that if your app is set to run on more than one Engine or is Autoscaling, the script will be executed on each of these Engines. That's how node cron jobs work. So for example, if your application is running on 8 engines the function will be called 8 times. Therefore, I would recommend you to use Background Jobs instead of cron jobs.