mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(core): Use AbortController to notify nodes to abort execution (#6141)
and add support for cancelling ongoing operations inside a node. --------- Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
committed by
GitHub
parent
0ec67dabf7
commit
d2c18c5727
@@ -422,6 +422,7 @@ export interface IGetExecuteFunctions {
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
executeData: IExecuteData,
|
||||
mode: WorkflowExecuteMode,
|
||||
abortSignal?: AbortSignal,
|
||||
): IExecuteFunctions;
|
||||
}
|
||||
|
||||
@@ -437,6 +438,7 @@ export interface IGetExecuteSingleFunctions {
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
executeData: IExecuteData,
|
||||
mode: WorkflowExecuteMode,
|
||||
abortSignal?: AbortSignal,
|
||||
): IExecuteSingleFunctions;
|
||||
}
|
||||
|
||||
@@ -776,6 +778,8 @@ type BaseExecutionFunctions = FunctionsBaseWithRequiredKeys<'getMode'> & {
|
||||
getExecuteData(): IExecuteData;
|
||||
getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
|
||||
getInputSourceData(inputIndex?: number, inputName?: string): ISourceData;
|
||||
getExecutionCancelSignal(): AbortSignal | undefined;
|
||||
onExecutionCancellation(handler: () => unknown): void;
|
||||
};
|
||||
|
||||
// TODO: Create later own type only for Config-Nodes
|
||||
|
||||
@@ -79,6 +79,7 @@ export class RoutingNode {
|
||||
executeData: IExecuteData,
|
||||
nodeExecuteFunctions: INodeExecuteFunctions,
|
||||
credentialsDecrypted?: ICredentialsDecrypted,
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<INodeExecutionData[][] | null | undefined> {
|
||||
const items = inputData.main[0] as INodeExecutionData[];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
@@ -99,6 +100,7 @@ export class RoutingNode {
|
||||
this.additionalData,
|
||||
executeData,
|
||||
this.mode,
|
||||
abortSignal,
|
||||
);
|
||||
|
||||
let credentials: ICredentialDataDecryptedObject | undefined;
|
||||
@@ -136,6 +138,7 @@ export class RoutingNode {
|
||||
this.additionalData,
|
||||
executeData,
|
||||
this.mode,
|
||||
abortSignal,
|
||||
);
|
||||
const requestData: DeclarativeRestApiSettings.ResultOptions = {
|
||||
options: {
|
||||
|
||||
@@ -1216,6 +1216,7 @@ export class Workflow {
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
nodeExecuteFunctions: INodeExecuteFunctions,
|
||||
mode: WorkflowExecuteMode,
|
||||
abortSignal?: AbortSignal,
|
||||
): Promise<IRunNodeResponse> {
|
||||
const { node } = executionData;
|
||||
let inputData = executionData.data;
|
||||
@@ -1303,6 +1304,7 @@ export class Workflow {
|
||||
additionalData,
|
||||
executionData,
|
||||
mode,
|
||||
abortSignal,
|
||||
);
|
||||
const data =
|
||||
nodeType instanceof Node
|
||||
@@ -1385,6 +1387,8 @@ export class Workflow {
|
||||
nodeType,
|
||||
executionData,
|
||||
nodeExecuteFunctions,
|
||||
undefined,
|
||||
abortSignal,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user