fix: Handle memory issues gracefully (#5147)

* fix: add lost connection error

* fix: stop exec, open in new tab

* fix: only hosw if error failed

* fix: fix typo

* chore: eslint issue
This commit is contained in:
Mutasem Aldmour
2023-01-13 12:33:42 +01:00
committed by GitHub
parent d2d481f12e
commit 14454243e7
2 changed files with 22 additions and 0 deletions

View File

@@ -38,6 +38,8 @@ export const pushConnection = mixins(
reconnectTimeout: null as NodeJS.Timeout | null,
retryTimeout: null as NodeJS.Timeout | null,
pushMessageQueue: [] as Array<{ event: Event; retriesLeft: number }>,
connectRetries: 0,
lostConnection: false,
};
},
computed: {
@@ -53,6 +55,21 @@ export const pushConnection = mixins(
}
this.reconnectTimeout = setTimeout(() => {
this.connectRetries++;
const isWorkflowRunning = this.uiStore.isActionActive('workflowRunning');
if (this.connectRetries > 3 && !this.lostConnection && isWorkflowRunning) {
this.lostConnection = true;
this.workflowsStore.executingNode = null;
this.uiStore.removeActiveAction('workflowRunning');
this.$showMessage({
title: this.$locale.baseText('pushConnection.executionFailed'),
message: this.$locale.baseText('pushConnection.executionFailed.message'),
type: 'error',
duration: 0,
});
}
this.pushConnect();
}, 3000);
},
@@ -73,6 +90,9 @@ export const pushConnection = mixins(
this.eventSource.addEventListener(
'open',
() => {
this.connectRetries = 0;
this.lostConnection = false;
this.rootStore.pushConnectionActive = true;
if (this.reconnectTimeout !== null) {
clearTimeout(this.reconnectTimeout);