From c5f90501ef9e5c7d2eedb504769b0d59264eb7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bugsounet=20-=20C=C3=A9dric?= Date: Thu, 21 Mar 2024 13:43:04 +0100 Subject: [PATCH] [calendar] deny fetch interval < 60000 and set 60000 in this case (prevent fetch loop failed) (#3382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, I had the case of some users who set a very small fetchinterval (10 sec for example) in some cases, it may be that the request did not have time to complete correctly and that the next one has already been sent (generally on start of MM²) I think that lock min fetchInterval to 60000 is a good idea --- CHANGELOG.md | 1 + modules/default/calendar/node_helper.js | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c7ef5c..8e119659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ _This release is scheduled to be released on 2024-04-01._ - Ignore all custom css files (#3359) - [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361) - Changed `log.debug` to `log.log` in `app.js` where logLevel is not set because config is not loaded at this time (#3353) +- [calandar] deny fetch interval < 60000 and set 60000 in this case (prevent fetch loop failed) (#3382) - added message in case where config.js is missing the module.export line PR #3383 - Fixed an issue where recurring events could extend past their recurrence end date (#3393) - Don't display any `npm WARN <....>` on install (#3399) diff --git a/modules/default/calendar/node_helper.js b/modules/default/calendar/node_helper.js index e4859260..7901abf0 100644 --- a/modules/default/calendar/node_helper.js +++ b/modules/default/calendar/node_helper.js @@ -47,9 +47,14 @@ module.exports = NodeHelper.create({ } let fetcher; + let fetchIntervalCorrected; if (typeof this.fetchers[identifier + url] === "undefined") { - Log.log(`Create new calendarfetcher for url: ${url} - Interval: ${fetchInterval}`); - fetcher = new CalendarFetcher(url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents, selfSignedCert); + if (fetchInterval < 60000) { + Log.warn(`fetchInterval for url ${url} must be >= 60000`); + fetchIntervalCorrected = 60000; + } + Log.log(`Create new calendarfetcher for url: ${url} - Interval: ${fetchIntervalCorrected || fetchInterval}`); + fetcher = new CalendarFetcher(url, fetchIntervalCorrected || fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents, selfSignedCert); fetcher.onReceive((fetcher) => { this.broadcastEvents(fetcher, identifier);