refactor(core): Abstract away duplication when finding first pinned trigger (no-changelog) (#5927)

This commit is contained in:
Michael Kret
2023-08-10 15:06:16 +03:00
committed by GitHub
parent 258e0ebb0f
commit 7f0db60f15
4 changed files with 66 additions and 16 deletions

View File

@@ -37,9 +37,12 @@ import type {
} from '@/Interfaces';
import { NodeTypes } from '@/NodeTypes';
import type { Job, JobData, JobQueue, JobResponse } from '@/Queue';
// eslint-disable-next-line import/no-cycle
import { Queue } from '@/Queue';
import * as WebhookHelpers from '@/WebhookHelpers';
// eslint-disable-next-line import/no-cycle
import * as WorkflowHelpers from '@/WorkflowHelpers';
// eslint-disable-next-line import/no-cycle
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
import { initErrorHandling } from '@/ErrorReporting';
@@ -345,13 +348,7 @@ export class WorkflowRunner {
Logger.debug(`Execution ID ${executionId} will run executing all nodes.`, { executionId });
// Execute all nodes
let startNode;
if (
data.startNodes?.length === 1 &&
Object.keys(data.pinData ?? {}).includes(data.startNodes[0])
) {
startNode = workflow.getNode(data.startNodes[0]) ?? undefined;
}
const startNode = WorkflowHelpers.getExecutionStartNode(data, workflow);
// Can execute without webhook so go on
const workflowExecute = new WorkflowExecute(additionalData, data.executionMode);