I need to run a scheduler every 5 min which will do few http calls . After first time I want to start the next timer only when all the http calls are finished. How can I do this cannot find the solution on 'node-cron' documentation. This is how I am trying to do.
const CronJob = require('cron').CronJob;
const axios = require("axios");
const job = new CronJob('* */5 * * * *', function() {
console.log(new Date());
calls();
},null,true);
function calls(){
job.stop();
axios.get("url").then((res)=>{
console.log(res.data);
job.start();
})
}