add a new execution status type executionWaiting

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-11-12 11:52:40 +01:00
parent 78c42b7f26
commit f7d26519ff
No known key found for this signature in database
4 changed files with 19 additions and 6 deletions

View file

@ -12,6 +12,13 @@ type ExecutionStarted = {
};
};
type ExecutionWaiting = {
type: 'executionWaiting';
data: {
executionId: string;
};
};
type ExecutionFinished = {
type: 'executionFinished';
data: {
@ -45,6 +52,7 @@ type NodeExecuteAfter = {
export type ExecutionPushMessage =
| ExecutionStarted
| ExecutionWaiting
| ExecutionFinished
| ExecutionRecovered
| NodeExecuteBefore

View file

@ -309,7 +309,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
},
],
workflowExecuteAfter: [
async function (this: WorkflowHooks): Promise<void> {
async function (this: WorkflowHooks, fullRunData: IRun): Promise<void> {
const { pushRef, executionId } = this;
if (pushRef === undefined) return;
@ -320,7 +320,9 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
workflowId,
});
pushInstance.send('executionFinished', { executionId }, pushRef);
const pushType =
fullRunData.status === 'waiting' ? 'executionWaiting' : 'executionFinished';
pushInstance.send(pushType, { executionId }, pushRef);
},
],
};

View file

@ -913,7 +913,6 @@ export class WorkflowExecute {
let nodeSuccessData: INodeExecutionData[][] | null | undefined;
let runIndex: number;
let startTime: number;
let taskData: ITaskData;
if (this.runExecutionData.startData === undefined) {
this.runExecutionData.startData = {};
@ -1443,12 +1442,12 @@ export class WorkflowExecute {
this.runExecutionData.resultData.runData[executionNode.name] = [];
}
taskData = {
const taskData: ITaskData = {
hints: executionHints,
startTime,
executionTime: new Date().getTime() - startTime,
source: !executionData.source ? [] : executionData.source.main,
executionStatus: 'success',
executionStatus: this.runExecutionData.waitTill ? 'waiting' : 'success',
};
if (executionError !== undefined) {

View file

@ -446,13 +446,17 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
runDataExecutedStartData: iRunExecutionData.startData,
resultDataError: iRunExecutionData.resultData.error,
});
} else if (receivedData.type === 'executionWaiting') {
// Nothing to do
} else if (receivedData.type === 'executionStarted') {
// Nothing to do
} else if (receivedData.type === 'nodeExecuteAfter') {
// A node finished to execute. Add its data
const pushData = receivedData.data;
workflowsStore.addNodeExecutionData(pushData);
workflowsStore.removeExecutingNode(pushData.nodeName);
if (pushData.data.executionStatus !== 'waiting') {
workflowsStore.removeExecutingNode(pushData.nodeName);
}
void assistantStore.onNodeExecution(pushData);
} else if (receivedData.type === 'nodeExecuteBefore') {
// A node started to be executed. Set it as executing.