Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Retry before continue on fail #9395

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion packages/core/src/WorkflowExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
NodeConnectionType,
ApplicationError,
NodeExecutionOutput,
sleep,
} from 'n8n-workflow';
import get from 'lodash/get';
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
Expand Down Expand Up @@ -1054,7 +1055,7 @@ export class WorkflowExecute {
workflowId: workflow.id,
});

const runNodeData = await workflow.runNode(
let runNodeData = await workflow.runNode(
executionData,
this.runExecutionData,
runIndex,
Expand All @@ -1066,6 +1067,24 @@ export class WorkflowExecute {

nodeSuccessData = runNodeData.data;

const didContinueOnFail = nodeSuccessData?.at(0)?.at(0)?.json.error !== undefined;

while (didContinueOnFail && tryIndex !== maxTries - 1) {
ivov marked this conversation as resolved.
Show resolved Hide resolved
await sleep(waitBetweenTries);

runNodeData = await workflow.runNode(
executionData,
this.runExecutionData,
runIndex,
this.additionalData,
NodeExecuteFunctions,
this.mode,
this.abortController.signal,
);

tryIndex++;
}

if (nodeSuccessData instanceof NodeExecutionOutput) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const hints: NodeExecutionHint[] = nodeSuccessData.getHints();
Expand Down
Loading