have refresh interval set in code before setting up cron

This commit is contained in:
Ryan Mwangi 2024-10-03 01:07:55 +03:00
parent 5a5fcaeeac
commit 35b9284a7a

View file

@ -118,6 +118,14 @@ async function updateMergedCalendar(){
console.error(error); 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 // Schedule a cron job to update the merged calendar every hour
cron.schedule('0 * * * *', () => { cron.schedule('0 * * * *', () => {
console.log('Updating merged calendar...'); console.log('Updating merged calendar...');