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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);

View file

@ -955,6 +955,8 @@
"pushConnectionTracker.connectionLost": "Connection lost",
"pushConnection.pollingNode.dataNotFound": "No {service} data found",
"pushConnection.pollingNode.dataNotFound.message": "We didnt find any data in {service} to simulate an event. Please create one in {service} and try again.",
"pushConnection.executionFailed": "Execution failed",
"pushConnection.executionFailed.message": "There might not be enough memory to finish execution. Tips for avoiding this <a target=\"_blank\" href=\"https://docs.n8n.io/flow-logic/error-handling/memory-errors/\">here</a>",
"resourceLocator.id.placeholder": "Enter ID...",
"resourceLocator.mode.id": "By ID",
"resourceLocator.mode.url": "By URL",