fix(http-fetcher): fall back to reloadInterval after retries exhausted#4113
Open
KristjanESPERANTO wants to merge 3 commits intoMagicMirrorOrg:developfrom
Open
fix(http-fetcher): fall back to reloadInterval after retries exhausted#4113KristjanESPERANTO wants to merge 3 commits intoMagicMirrorOrg:developfrom
KristjanESPERANTO wants to merge 3 commits intoMagicMirrorOrg:developfrom
Conversation
When networkErrorCount or serverErrorCount reaches maxRetries, calculateBackoffDelay produced a fixed short delay instead of respecting the user's configured reloadInterval. Skip backoff once retries are exhausted and use reloadInterval directly. Both network and server error paths now use the same calculateBackoffDelay strategy for consistency.
- Extract URL truncation into private #shortenUrl() method - Use #shortenUrl() consistently in all log messages - Merge duplicate networkErrorCount >= maxRetries checks into a single if/else block that handles both delay calculation and logging - Replace logFn.call(Log, ...) with explicit if/else for clarity - Remove redundant inline JSDoc for error event
Verify that both network and server errors fall back to reloadInterval after maxRetries is reached, and that error counts reset on success.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As reported in #4109, the weather module retries much more frequently than expected after network errors. #4092 already fixed the main cause (duplicate fetchers), but the backoff logic in
HTTPFetcherstill has a gap: once retries are exhausted,calculateBackoffDelaykeeps returning a short fixed delay (60s) instead of falling back toreloadInterval. The same problem existed for 5xx errors, where the delay grew to 8× the configured interval.Inspired by #4110 (thanks @CodeLine9), this PR makes both error paths fall back to
reloadIntervalafter retries are exhausted. I also simplified the catch block, extracted a#shortenUrl()helper for log messages, and added tests for the backoff progression.