Read the statement by Michael Teeuw here.
Calendar Module Error with Many Google Calendars
-
@moorevineyard you can set the fetch interval by url too
-
I did some more testing and it appears that there may be some sort of rate limit with Google. I haven’t been able to find anything published, but slowing down the fetch process seems to fix the problem.
I’m not super great with JavaScript and don’t know anything about NodeJS, but this is what I did. In the calendar.js file, starting in line 121 and then down around line 158 I changed the following:
this.config.calendars.forEach((calendar, index) => { // added index calendar.url = calendar.url.replace("webcal://", "http://"); const calendarConfig = { maximumEntries: calendar.maximumEntries, maximumNumberOfDays: calendar.maximumNumberOfDays, pastDaysCount: calendar.pastDaysCount, broadcastPastEvents: calendar.broadcastPastEvents, selfSignedCert: calendar.selfSignedCert, excludedEvents: calendar.excludedEvents, fetchInterval: calendar.fetchInterval }; if (typeof calendar.symbolClass === "undefined" || calendar.symbolClass === null) { calendarConfig.symbolClass = ""; } if (typeof calendar.titleClass === "undefined" || calendar.titleClass === null) { calendarConfig.titleClass = ""; } if (typeof calendar.timeClass === "undefined" || calendar.timeClass === null) { calendarConfig.timeClass = ""; } // we check user and password here for backwards compatibility with old configs if (calendar.user && calendar.pass) { Log.warn("Deprecation warning: Please update your calendar authentication configuration."); Log.warn("https://docs.magicmirror.builders/modules/calendar.html#configuration-options"); calendar.auth = { user: calendar.user, pass: calendar.pass }; } /* * tell helper to start a fetcher for this calendar * fetcher till cycle */ setTimeout(() => { // added this.addCalendar(calendar.url, calendar.auth, calendarConfig); }, index * 5000); // 5-second delay for each calendar });
This appears to add a 5 second delay to each of the fetches (one fetch occurs every 5 seconds during startup). I added a couple random calendars and now up to 11 seems to work without a problem.
Is it worth adding a configuration option to introduce the delay? Is Github the best place to make these kinds of suggestions?
-
@moorevineyard yes, github
you could create a pull request with the code solution
maybe just do it if the count is over 4 ?11*5 = 55 seconds, almost a minute before some calendars display. Some would not like any delay