From 34401599cc27fd3096298397c9809217339109e0 Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 10 Jul 2023 17:33:59 +0200 Subject: [PATCH] fix(editor): Don't reconnect Editor on connection issues SyncService will resend failed steps after network has recovered. Remove obsolete `data.retry` flag when emitting error of `ERROR_TYPE.CONNECTION_FAILED`. Fixes: #4340 Signed-off-by: Jonas --- src/components/Editor.vue | 6 +----- src/services/PollingBackend.js | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/Editor.vue b/src/components/Editor.vue index ccf93dbe677..b8a807481fc 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -573,11 +573,7 @@ export default { } if (type === ERROR_TYPE.CONNECTION_FAILED && !this.hasConnectionIssue) { this.hasConnectionIssue = true - // FIXME: ideally we just try to reconnect in the service, so we don't loose steps - OC.Notification.showTemporary('Connection failed, reconnecting') - if (data.retry !== false) { - setTimeout(this.reconnect.bind(this), 5000) - } + OC.Notification.showTemporary('Connection failed.') } if (type === ERROR_TYPE.SOURCE_NOT_FOUND) { this.hasConnectionIssue = true diff --git a/src/services/PollingBackend.js b/src/services/PollingBackend.js index a96d0f7ab4f..86c6e14b95e 100644 --- a/src/services/PollingBackend.js +++ b/src/services/PollingBackend.js @@ -157,7 +157,7 @@ class PollingBackend { if (!e.response || e.code === 'ECONNABORTED') { if (this.#fetchRetryCounter++ >= MAX_RETRY_FETCH_COUNT) { logger.error('[PollingBackend:fetchSteps] Network error when fetching steps, emitting CONNECTION_FAILED') - this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: { retry: false } }) + this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: {} }) } else { logger.error(`[PollingBackend:fetchSteps] Network error when fetching steps, retry ${this.#fetchRetryCounter}`) @@ -180,11 +180,11 @@ class PollingBackend { this.disconnect() } else if (e.response.status === 503) { this.increaseRefetchTimer() - this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: { retry: false } }) + this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: {} }) logger.error('Failed to fetch steps due to unavailable service', { error: e }) } else { this.disconnect() - this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: { retry: false } }) + this.#syncService.emit('error', { type: ERROR_TYPE.CONNECTION_FAILED, data: {} }) logger.error('Failed to fetch steps due to other reason', { error: e }) }