Skip to content

Commit 032ed99

Browse files
committed
fix(PollingBackend): increase poll interval on repeated network errors
When returning to a backgrounded tab, `visibilitychange` resets the fetch interval to the minimum (300ms). Network errors never called `increaseRefetchTimer()`, so the aggressive rate persisted indefinitely while offline, causing ~3 sync requests per second. Signed-off-by: Jonas <jonas@freesources.org>
1 parent 930bd9c commit 032ed99

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/services/PollingBackend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class PollingBackend {
179179
}) {
180180
if (!e.response || e.code === 'ECONNABORTED') {
181181
if (this.#fetchRetryCounter++ >= MAX_RETRY_FETCH_COUNT) {
182+
this.increaseRefetchTimer()
182183
logger.error(
183184
'[PollingBackend:fetchSteps] Network error when fetching steps, emitting CONNECTION_FAILED',
184185
)

0 commit comments

Comments
 (0)