mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-05 07:08:19 +00:00
Merge pull request #2162 from sdetweil/fixfetch
Fix calendar subsequent fetch timing with multiple calendar entries
This commit is contained in:
commit
8c04712784
@ -21,6 +21,7 @@ _This release is scheduled to be released on 2021-01-01._
|
||||
- JSON Parse translation files with comments crashing UI. (#2149)
|
||||
- Calendar parsing where RRULE bug returns wrong date, add Windows timezone name support. (#2145, #2151)
|
||||
- Wrong node-ical version installed (package.json) requested version. (#2153)
|
||||
- Fix calendar fetcher subsequent timing (#2160)
|
||||
|
||||
## [2.13.0] - 2020-10-01
|
||||
|
||||
|
@ -58,6 +58,8 @@ Module.register("calendar", {
|
||||
nextDaysRelative: false
|
||||
},
|
||||
|
||||
requiresVersion: "2.1.0",
|
||||
|
||||
// Define required scripts.
|
||||
getStyles: function () {
|
||||
return ["calendar.css", "font-awesome.css"];
|
||||
@ -83,6 +85,12 @@ Module.register("calendar", {
|
||||
// Set locale.
|
||||
moment.updateLocale(config.language, this.getLocaleSpecification(config.timeFormat));
|
||||
|
||||
// clear data holder before start
|
||||
this.calendarData = {};
|
||||
|
||||
// indicate no data available yet
|
||||
this.loaded = false;
|
||||
|
||||
for (var c in this.config.calendars) {
|
||||
var calendar = this.config.calendars[c];
|
||||
calendar.url = calendar.url.replace("webcal://", "http://");
|
||||
@ -112,18 +120,10 @@ Module.register("calendar", {
|
||||
};
|
||||
}
|
||||
|
||||
// tell helper to start a fetcher for this calendar
|
||||
// fetcher till cycle
|
||||
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
||||
|
||||
// Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar
|
||||
// fetcher running on the server side.
|
||||
var self = this;
|
||||
setInterval(function () {
|
||||
self.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
||||
}, self.config.fetchInterval);
|
||||
}
|
||||
|
||||
this.calendarData = {};
|
||||
this.loaded = false;
|
||||
},
|
||||
|
||||
// Override socket notification handler.
|
||||
@ -541,6 +541,8 @@ Module.register("calendar", {
|
||||
* @param {object} calendarConfig The config of the specific calendar
|
||||
*/
|
||||
addCalendar: function (url, auth, calendarConfig) {
|
||||
var self = this;
|
||||
|
||||
this.sendSocketNotification("ADD_CALENDAR", {
|
||||
id: this.identifier,
|
||||
url: url,
|
||||
|
@ -70,7 +70,6 @@ module.exports = NodeHelper.create({
|
||||
} else {
|
||||
Log.log("Use existing calendar fetcher for url: " + url);
|
||||
fetcher = self.fetchers[identifier + url];
|
||||
fetcher.broadcastEvents();
|
||||
}
|
||||
|
||||
fetcher.startFetch();
|
||||
|
Loading…
x
Reference in New Issue
Block a user