Skip to content

Commit

Permalink
fix(Account): Use exponential backoff instead of disabling profile af…
Browse files Browse the repository at this point in the history
…ter 10 errors

fixes #1660

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Jun 30, 2024
1 parent 0202760 commit fe091fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/lib/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion src/lib/browser/BrowserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/ui/components/AccountCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@
{{ t('LabelDebuglogs') }}
</v-btn>
</v-alert>
<v-alert
v-if="account.data.error && !account.data.enabled && Number(account.data.errorCount) > 9"
dense
outlined
:type="'warning'">
{{ t('DescriptionDisabledaftererror') }}
</v-alert>
<v-alert
v-if="legacyWarning"
dense
Expand Down

0 comments on commit fe091fd

Please sign in to comment.