mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
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:
parent
d2d481f12e
commit
14454243e7
|
@ -38,6 +38,8 @@ export const pushConnection = mixins(
|
||||||
reconnectTimeout: null as NodeJS.Timeout | null,
|
reconnectTimeout: null as NodeJS.Timeout | null,
|
||||||
retryTimeout: null as NodeJS.Timeout | null,
|
retryTimeout: null as NodeJS.Timeout | null,
|
||||||
pushMessageQueue: [] as Array<{ event: Event; retriesLeft: number }>,
|
pushMessageQueue: [] as Array<{ event: Event; retriesLeft: number }>,
|
||||||
|
connectRetries: 0,
|
||||||
|
lostConnection: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -53,6 +55,21 @@ export const pushConnection = mixins(
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reconnectTimeout = setTimeout(() => {
|
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();
|
this.pushConnect();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
},
|
},
|
||||||
|
@ -73,6 +90,9 @@ export const pushConnection = mixins(
|
||||||
this.eventSource.addEventListener(
|
this.eventSource.addEventListener(
|
||||||
'open',
|
'open',
|
||||||
() => {
|
() => {
|
||||||
|
this.connectRetries = 0;
|
||||||
|
this.lostConnection = false;
|
||||||
|
|
||||||
this.rootStore.pushConnectionActive = true;
|
this.rootStore.pushConnectionActive = true;
|
||||||
if (this.reconnectTimeout !== null) {
|
if (this.reconnectTimeout !== null) {
|
||||||
clearTimeout(this.reconnectTimeout);
|
clearTimeout(this.reconnectTimeout);
|
||||||
|
|
|
@ -955,6 +955,8 @@
|
||||||
"pushConnectionTracker.connectionLost": "Connection lost",
|
"pushConnectionTracker.connectionLost": "Connection lost",
|
||||||
"pushConnection.pollingNode.dataNotFound": "No {service} data found",
|
"pushConnection.pollingNode.dataNotFound": "No {service} data found",
|
||||||
"pushConnection.pollingNode.dataNotFound.message": "We didn’t find any data in {service} to simulate an event. Please create one in {service} and try again.",
|
"pushConnection.pollingNode.dataNotFound.message": "We didn’t 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.id.placeholder": "Enter ID...",
|
||||||
"resourceLocator.mode.id": "By ID",
|
"resourceLocator.mode.id": "By ID",
|
||||||
"resourceLocator.mode.url": "By URL",
|
"resourceLocator.mode.url": "By URL",
|
||||||
|
|
Loading…
Reference in a new issue