From 35b9284a7a42995eee954deeb8260593fe2672a0 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Thu, 3 Oct 2024 01:07:55 +0300 Subject: [PATCH] have refresh interval set in code before setting up cron --- server.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.js b/server.js index b5c3c9e..bff353a 100644 --- a/server.js +++ b/server.js @@ -118,6 +118,14 @@ async function updateMergedCalendar(){ console.error(error); } } + +const refreshInterval = 60 * 60 * 1000; // 1 hour + +setInterval(() => { + // Fetch new calendar data and update the merged calendar + updateMergedCalendar(); +}, refreshInterval); + // Schedule a cron job to update the merged calendar every hour cron.schedule('0 * * * *', () => { console.log('Updating merged calendar...');