Skip to content

Commit b8a0b53

Browse files
refactor(calendar): simplify shouldRefetch to use fetchInterval directly
Remove unnecessary parameter from shouldRefetch() and use the fetcher's reloadInterval directly. This respects the user's configured fetchInterval as the threshold for rate limit protection.
1 parent 8892cd3 commit b8a0b53

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

modules/default/calendar/calendarfetcher.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,16 @@ class CalendarFetcher {
182182
}
183183

184184
/**
185-
* Check if enough time has passed since the last fetch to warrant a new one
186-
* @param {number} minInterval - Minimum milliseconds between fetches (default: 3 minutes)
185+
* Check if enough time has passed since the last fetch to warrant a new one.
186+
* Uses reloadInterval as the threshold to respect user's configured fetchInterval.
187187
* @returns {boolean} True if a new fetch should be performed
188188
*/
189-
shouldRefetch (minInterval = 3 * 60 * 1000) {
189+
shouldRefetch () {
190190
if (!this.lastFetch) {
191191
return true;
192192
}
193-
return (Date.now() - this.lastFetch) >= minInterval;
193+
const timeSinceLastFetch = Date.now() - this.lastFetch;
194+
return timeSinceLastFetch >= this.reloadInterval;
194195
}
195196

196197
/**

0 commit comments

Comments
 (0)