You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a single job entry in the database, when the server time reach the sleepUnitl time, the job is being executed twice inside the onDocument method.
const{ MongoCron }=require('mongodb-cron');module.exports=asyncapp=>{constmongooseClient=app.get('mongooseClient');constcollection=awaitmongooseClient.connections[0].collections['cron-jobs'];constcron=newMongoCron({
collection,onStart: ()=>console.info('\t✓ Cron jobs.'),onDocument: doc=>console.count(),// You will get a 2 console logs here!onError: asyncerr=>console.error(err),nextDelay: 1000,reprocessDelay: 1000,idleDelay: 1000});cron.start();};
The text was updated successfully, but these errors were encountered:
I'm potentially running into similar behaviour. Does it seem to stop doing it when you increase e.g. nextDelay? For me it seem to ignore the interval if I set a nextDelay. My interval while testing is set to run at 0, 15, 30, and 45 seconds, but with nextDelay (or idleDelay) set to e.g. 10 seconds, it runs every tenth second. The implication of this is that I can't have a reasonable nextDelay set and my CPU usage is getting high...
I have a single job entry in the database, when the server time reach the sleepUnitl time, the job is being executed twice inside the onDocument method.
Here are my settings:
MongoDB Schema
MondoDB Entry
Cron job execution code
The text was updated successfully, but these errors were encountered: