mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
add a new execution status type executionWaiting
This commit is contained in:
parent
78c42b7f26
commit
f7d26519ff
|
@ -12,6 +12,13 @@ type ExecutionStarted = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ExecutionWaiting = {
|
||||||
|
type: 'executionWaiting';
|
||||||
|
data: {
|
||||||
|
executionId: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
type ExecutionFinished = {
|
type ExecutionFinished = {
|
||||||
type: 'executionFinished';
|
type: 'executionFinished';
|
||||||
data: {
|
data: {
|
||||||
|
@ -45,6 +52,7 @@ type NodeExecuteAfter = {
|
||||||
|
|
||||||
export type ExecutionPushMessage =
|
export type ExecutionPushMessage =
|
||||||
| ExecutionStarted
|
| ExecutionStarted
|
||||||
|
| ExecutionWaiting
|
||||||
| ExecutionFinished
|
| ExecutionFinished
|
||||||
| ExecutionRecovered
|
| ExecutionRecovered
|
||||||
| NodeExecuteBefore
|
| NodeExecuteBefore
|
||||||
|
|
|
@ -309,7 +309,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
workflowExecuteAfter: [
|
workflowExecuteAfter: [
|
||||||
async function (this: WorkflowHooks): Promise<void> {
|
async function (this: WorkflowHooks, fullRunData: IRun): Promise<void> {
|
||||||
const { pushRef, executionId } = this;
|
const { pushRef, executionId } = this;
|
||||||
if (pushRef === undefined) return;
|
if (pushRef === undefined) return;
|
||||||
|
|
||||||
|
@ -320,7 +320,9 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||||
workflowId,
|
workflowId,
|
||||||
});
|
});
|
||||||
|
|
||||||
pushInstance.send('executionFinished', { executionId }, pushRef);
|
const pushType =
|
||||||
|
fullRunData.status === 'waiting' ? 'executionWaiting' : 'executionFinished';
|
||||||
|
pushInstance.send(pushType, { executionId }, pushRef);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -913,7 +913,6 @@ export class WorkflowExecute {
|
||||||
let nodeSuccessData: INodeExecutionData[][] | null | undefined;
|
let nodeSuccessData: INodeExecutionData[][] | null | undefined;
|
||||||
let runIndex: number;
|
let runIndex: number;
|
||||||
let startTime: number;
|
let startTime: number;
|
||||||
let taskData: ITaskData;
|
|
||||||
|
|
||||||
if (this.runExecutionData.startData === undefined) {
|
if (this.runExecutionData.startData === undefined) {
|
||||||
this.runExecutionData.startData = {};
|
this.runExecutionData.startData = {};
|
||||||
|
@ -1443,12 +1442,12 @@ export class WorkflowExecute {
|
||||||
this.runExecutionData.resultData.runData[executionNode.name] = [];
|
this.runExecutionData.resultData.runData[executionNode.name] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
taskData = {
|
const taskData: ITaskData = {
|
||||||
hints: executionHints,
|
hints: executionHints,
|
||||||
startTime,
|
startTime,
|
||||||
executionTime: new Date().getTime() - startTime,
|
executionTime: new Date().getTime() - startTime,
|
||||||
source: !executionData.source ? [] : executionData.source.main,
|
source: !executionData.source ? [] : executionData.source.main,
|
||||||
executionStatus: 'success',
|
executionStatus: this.runExecutionData.waitTill ? 'waiting' : 'success',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (executionError !== undefined) {
|
if (executionError !== undefined) {
|
||||||
|
|
|
@ -446,13 +446,17 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
|
||||||
runDataExecutedStartData: iRunExecutionData.startData,
|
runDataExecutedStartData: iRunExecutionData.startData,
|
||||||
resultDataError: iRunExecutionData.resultData.error,
|
resultDataError: iRunExecutionData.resultData.error,
|
||||||
});
|
});
|
||||||
|
} else if (receivedData.type === 'executionWaiting') {
|
||||||
|
// Nothing to do
|
||||||
} else if (receivedData.type === 'executionStarted') {
|
} else if (receivedData.type === 'executionStarted') {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
} else if (receivedData.type === 'nodeExecuteAfter') {
|
} else if (receivedData.type === 'nodeExecuteAfter') {
|
||||||
// A node finished to execute. Add its data
|
// A node finished to execute. Add its data
|
||||||
const pushData = receivedData.data;
|
const pushData = receivedData.data;
|
||||||
workflowsStore.addNodeExecutionData(pushData);
|
workflowsStore.addNodeExecutionData(pushData);
|
||||||
|
if (pushData.data.executionStatus !== 'waiting') {
|
||||||
workflowsStore.removeExecutingNode(pushData.nodeName);
|
workflowsStore.removeExecutingNode(pushData.nodeName);
|
||||||
|
}
|
||||||
void assistantStore.onNodeExecution(pushData);
|
void assistantStore.onNodeExecution(pushData);
|
||||||
} else if (receivedData.type === 'nodeExecuteBefore') {
|
} else if (receivedData.type === 'nodeExecuteBefore') {
|
||||||
// A node started to be executed. Set it as executing.
|
// A node started to be executed. Set it as executing.
|
||||||
|
|
Loading…
Reference in a new issue