From fe091fd6333114f377eafaa6f8646b0f7c6f0579 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 30 Jun 2024 12:30:06 +0200 Subject: [PATCH] fix(Account): Use exponential backoff instead of disabling profile after 10 errors fixes #1660 Signed-off-by: Marcel Klehr --- src/lib/Account.ts | 1 - src/lib/browser/BrowserController.js | 9 ++++++++- src/ui/components/AccountCard.vue | 7 ------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/Account.ts b/src/lib/Account.ts index 182a27d738..2508fa11f5 100644 --- a/src/lib/Account.ts +++ b/src/lib/Account.ts @@ -338,7 +338,6 @@ export default class Account { errorCount: this.getData().errorCount + 1, syncing: false, scheduled: false, - ...(this.getData().errorCount > 9 && {enabled: false}), // After 10 errors in a row, disable the account }) if (matchAllErrors(e, e => e.code !== 27 && (!isTest || e.code !== 26))) { await this.storage.setCurrentContinuation(null) diff --git a/src/lib/browser/BrowserController.js b/src/lib/browser/BrowserController.js index ab5e86da24..80846c089e 100644 --- a/src/lib/browser/BrowserController.js +++ b/src/lib/browser/BrowserController.js @@ -30,12 +30,19 @@ class AlarmManager { const interval = data.syncInterval || DEFAULT_SYNC_INTERVAL if (data.scheduled && data.enabled) { promises.push(this.ctl.scheduleSync(accountId)) + continue + } + if (data.error && data.errorCount > 1) { + const interval = 1000 * 60 * 5 // 5min + if (Date.now() > interval * 2 ** data.errorCount + lastSync) { + promises.push(this.ctl.scheduleSync(accountId)) + } + continue } if ( Date.now() > interval * 1000 * 60 + lastSync ) { - // noinspection ES6MissingAwait promises.push(this.ctl.scheduleSync(accountId)) } } diff --git a/src/ui/components/AccountCard.vue b/src/ui/components/AccountCard.vue index 4313b95ce6..7ebd98fb0b 100644 --- a/src/ui/components/AccountCard.vue +++ b/src/ui/components/AccountCard.vue @@ -64,13 +64,6 @@ {{ t('LabelDebuglogs') }} - - {{ t('DescriptionDisabledaftererror') }} -