From c6117e3470071364e420118f4434265298d3f4a4 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 22 Oct 2024 14:35:11 +0300 Subject: [PATCH] update cron job to use mergedCalendar.id when calling the updateMergedCalendars function --- server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 351bf35..f8987f3 100644 --- a/server.js +++ b/server.js @@ -241,7 +241,10 @@ app.post('/refresh/:id', async (req, res) => { // Schedule a cron job to update the merged calendar every hour cron.schedule('1 * * * *', () => { console.log('Updating merged calendar...'); - updateMergedCalendars(); + const calendarsData = JSON.parse(fs.readFileSync(CALENDARS_FILE, 'utf8')); + calendarsData.mergedCalendars.forEach((mergedCalendar) => { + updateMergedCalendars(mergedCalendar.id); + }); }); // Start the server