forked from ryanmwangi/CalMerger
have refresh interval set in code before setting up cron
This commit is contained in:
parent
5a5fcaeeac
commit
35b9284a7a
1 changed files with 8 additions and 0 deletions
|
@ -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...');
|
||||||
|
|
Loading…
Add table
Reference in a new issue