mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Retry before continue on fail (#9395)
This commit is contained in:
parent
8069faa5fe
commit
9b2ce819d4
|
@ -43,6 +43,7 @@ import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
ApplicationError,
|
ApplicationError,
|
||||||
NodeExecutionOutput,
|
NodeExecutionOutput,
|
||||||
|
sleep,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
|
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
|
||||||
|
@ -1054,7 +1055,7 @@ export class WorkflowExecute {
|
||||||
workflowId: workflow.id,
|
workflowId: workflow.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const runNodeData = await workflow.runNode(
|
let runNodeData = await workflow.runNode(
|
||||||
executionData,
|
executionData,
|
||||||
this.runExecutionData,
|
this.runExecutionData,
|
||||||
runIndex,
|
runIndex,
|
||||||
|
@ -1066,6 +1067,24 @@ export class WorkflowExecute {
|
||||||
|
|
||||||
nodeSuccessData = runNodeData.data;
|
nodeSuccessData = runNodeData.data;
|
||||||
|
|
||||||
|
const didContinueOnFail = nodeSuccessData?.at(0)?.at(0)?.json.error !== undefined;
|
||||||
|
|
||||||
|
while (didContinueOnFail && tryIndex !== maxTries - 1) {
|
||||||
|
await sleep(waitBetweenTries);
|
||||||
|
|
||||||
|
runNodeData = await workflow.runNode(
|
||||||
|
executionData,
|
||||||
|
this.runExecutionData,
|
||||||
|
runIndex,
|
||||||
|
this.additionalData,
|
||||||
|
NodeExecuteFunctions,
|
||||||
|
this.mode,
|
||||||
|
this.abortController.signal,
|
||||||
|
);
|
||||||
|
|
||||||
|
tryIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
if (nodeSuccessData instanceof NodeExecutionOutput) {
|
if (nodeSuccessData instanceof NodeExecutionOutput) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
const hints: NodeExecutionHint[] = nodeSuccessData.getHints();
|
const hints: NodeExecutionHint[] = nodeSuccessData.getHints();
|
||||||
|
|
Loading…
Reference in a new issue