From 74e081f9cecf1b581a2e1ed1ea93534153d94226 Mon Sep 17 00:00:00 2001 From: JPZV <38300410+JPZV@users.noreply.github.com> Date: Sat, 20 May 2023 11:30:50 -0400 Subject: [PATCH] Retrying fetch the calendar after an error There would be a more elegant solution, like checking the err.retry property, but anyway this will fix the calendar stop being updated after an error occurred, like an ECONNRESET --- node_helper.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/node_helper.js b/node_helper.js index e491ffd..15f7f7e 100644 --- a/node_helper.js +++ b/node_helper.js @@ -223,14 +223,14 @@ module.exports = NodeHelper.create({ id: identifier, error_type }); - return; + } else { + const events = res.data.items; + Log.info( + `${this.name}: ${events.length} events loaded for ${calendarID}` + ); + this.broadcastEvents(events, identifier, calendarID); } - - const events = res.data.items; - Log.info( - `${this.name}: ${events.length} events loaded for ${calendarID}` - ); - this.broadcastEvents(events, identifier, calendarID); + this.scheduleNextCalendarFetch( calendarID, fetchInterval,