1
0
Fork 0

update cron job to use mergedCalendar.id when calling the updateMergedCalendars function

This commit is contained in:
Ryan Mwangi 2024-10-22 14:35:11 +03:00
parent 77f19504a2
commit c6117e3470
1 changed files with 4 additions and 1 deletions

View File

@ -241,7 +241,10 @@ app.post('/refresh/:id', async (req, res) => {
// Schedule a cron job to update the merged calendar every hour // Schedule a cron job to update the merged calendar every hour
cron.schedule('1 * * * *', () => { cron.schedule('1 * * * *', () => {
console.log('Updating merged calendar...'); 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 // Start the server