export function check () {
console.log("Checking for new events")
clearInterval(interval)
let interval = setInterval(() => {
console.log("Checking for new events")
},2000)
}
I am living in UTC + 2 and therefore made sure to subtract 2 hours from my current time to enter the correct time in UTC in the jobs.config.
Thanks for your answer. The function is now being executed. However after a couple of minutes it stops. Does config kill the functions after a certain amount of time? I need to run a function in the backend every 10 seconds.
[@leon] I suspect that the job runs once and then exits. This is likely to be a cron job on the server which probably won’t allow a “secondary” timer to execute. This could tie up resources unnecessarily if lots of people do this. The idea behind jobs is to manage recurring batch functions that don’t need user interaction.
To do what you are trying to do I think you will only get a minute resolution and you would need a job to run every minute so a JSON file with around 1440 entries (one per minute).