fix(core): Fix issue where sub workflows would display as running forever after failure to start (#5905)

* fixed recovery / status for early return in main mode

* mark non-data returning executions in own mode as failed

* improve error handling
This commit is contained in:
Michael Auerswald
2023-04-06 11:36:11 +02:00
committed by GitHub
parent 2881ee9ecc
commit 3e382ef85e
3 changed files with 25 additions and 7 deletions

View File

@@ -638,7 +638,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
};
if (this.retryOf !== undefined) {
fullExecutionData.retryOf = this.retryOf.toString();
fullExecutionData.retryOf = this.retryOf?.toString();
}
const workflowId = this.workflowData.id;
@@ -1054,7 +1054,7 @@ async function executeWorkflow(
mode: 'integrated',
startedAt: new Date(),
stoppedAt: new Date(),
status: 'error',
status: 'failed',
};
// When failing, we might not have finished the execution
// Therefore, database might not contain finished errors.
@@ -1073,6 +1073,9 @@ async function executeWorkflow(
fullExecutionData.workflowId = workflowData.id;
}
// remove execution from active executions
Container.get(ActiveExecutions).remove(executionId, fullRunData);
const executionData = ResponseHelper.flattenExecutionData(fullExecutionData);
await Db.collections.Execution.update(executionId, executionData as IExecutionFlattedDb);