mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-25 11:31:38 -08:00
⚡ Reduce risk of errors causing never stopping workflows
This commit is contained in:
parent
8cceec1209
commit
e40f0e00a8
|
@ -212,31 +212,31 @@ export class WorkflowRunner {
|
||||||
workflowExecution = workflowExecute.runPartialWorkflow(workflow, data.runData, data.startNodes, data.destinationNode);
|
workflowExecution = workflowExecute.runPartialWorkflow(workflow, data.runData, data.startNodes, data.destinationNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.activeExecutions.attachWorkflowExecution(executionId, workflowExecution);
|
||||||
|
|
||||||
|
if (workflowTimeout > 0) {
|
||||||
|
const timeout = Math.min(workflowTimeout, config.get('executions.maxTimeout') as number) * 1000; // as seconds
|
||||||
|
executionTimeout = setTimeout(() => {
|
||||||
|
this.activeExecutions.stopExecution(executionId, 'timeout');
|
||||||
|
}, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
workflowExecution.then((fullRunData) => {
|
||||||
|
clearTimeout(executionTimeout);
|
||||||
|
if (workflowExecution.isCanceled) {
|
||||||
|
fullRunData.finished = false;
|
||||||
|
}
|
||||||
|
this.activeExecutions.remove(executionId, fullRunData);
|
||||||
|
}).catch((error) => {
|
||||||
|
this.processError(error, new Date(), data.executionMode, executionId, additionalData.hooks);
|
||||||
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await this.processError(error, new Date(), data.executionMode, executionId, additionalData.hooks);
|
await this.processError(error, new Date(), data.executionMode, executionId, additionalData.hooks);
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activeExecutions.attachWorkflowExecution(executionId, workflowExecution);
|
|
||||||
|
|
||||||
if (workflowTimeout > 0) {
|
|
||||||
const timeout = Math.min(workflowTimeout, config.get('executions.maxTimeout') as number) * 1000; // as seconds
|
|
||||||
executionTimeout = setTimeout(() => {
|
|
||||||
this.activeExecutions.stopExecution(executionId, 'timeout');
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
workflowExecution.then((fullRunData) => {
|
|
||||||
clearTimeout(executionTimeout);
|
|
||||||
if (workflowExecution.isCanceled) {
|
|
||||||
fullRunData.finished = false;
|
|
||||||
}
|
|
||||||
this.activeExecutions.remove(executionId, fullRunData);
|
|
||||||
}).catch((error) => {
|
|
||||||
this.processError(error, new Date(), data.executionMode, executionId, additionalData.hooks);
|
|
||||||
});
|
|
||||||
|
|
||||||
return executionId;
|
return executionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue