From e5ae4c77eb8d18eaeec4980150f8bd8b60a1b81e Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 17 Jan 2020 19:49:31 -0600 Subject: [PATCH] :zap: Change same-process-execution setting to make it future proof --- docs/configuration.md | 2 +- packages/cli/config/index.ts | 17 +++++++++++------ packages/cli/src/WorkflowRunner.ts | 8 ++++---- packages/core/src/WorkflowExecute.ts | 2 -- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 2bd789e2b3..503e90b075 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -87,7 +87,7 @@ workflows are not CPU intensive and they have to start very fast it is possible all directly in the main-process with this setting. ```bash -export EXECUTIONS_SAME_PROCESS=true +export EXECUTIONS_PROCESS=main ``` diff --git a/packages/cli/config/index.ts b/packages/cli/config/index.ts index b0eae64bd6..ab75bb0527 100644 --- a/packages/cli/config/index.ts +++ b/packages/cli/config/index.ts @@ -55,6 +55,17 @@ const config = convict({ }, executions: { + + // By default workflows get always executed in their own process. + // If this option gets set to "main" it will run them in the + // main-process instead. + process: { + doc: 'In what process workflows should be executed', + format: ['main', 'own'], + default: 'own', + env: 'EXECUTIONS_PROCESS' + }, + // If a workflow executes all the data gets saved by default. This // could be a problem when a workflow gets executed a lot and processes // a lot of data. To not write the database full it is possible to @@ -84,12 +95,6 @@ const config = convict({ default: false, env: 'EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS' }, - - sameProcessExecution: { - doc: 'Executes the workflows in the same process instead of in a separate one', - default: false, - env: 'EXECUTIONS_SAME_PROCESS' - }, }, generic: { diff --git a/packages/cli/src/WorkflowRunner.ts b/packages/cli/src/WorkflowRunner.ts index fc00e33d30..ec3571a5c2 100644 --- a/packages/cli/src/WorkflowRunner.ts +++ b/packages/cli/src/WorkflowRunner.ts @@ -94,9 +94,9 @@ export class WorkflowRunner { * @memberof WorkflowRunner */ async run(data: IWorkflowExecutionDataProcess, loadStaticData?: boolean): Promise { - const sameProcessExecution = config.get('executions.sameProcessExecution') as boolean; - if (sameProcessExecution === true) { - return this.runSameProcess(data, loadStaticData); + const executionsProcess = config.get('executions.process') as string; + if (executionsProcess === 'main') { + return this.runMainProcess(data, loadStaticData); } return this.runSubprocess(data, loadStaticData); @@ -112,7 +112,7 @@ export class WorkflowRunner { * @returns {Promise} * @memberof WorkflowRunner */ - async runSameProcess(data: IWorkflowExecutionDataProcess, loadStaticData?: boolean): Promise { + async runMainProcess(data: IWorkflowExecutionDataProcess, loadStaticData?: boolean): Promise { if (loadStaticData === true && data.workflowData.id) { data.workflowData.staticData = await WorkflowHelpers.getStaticDataById(data.workflowData.id as string); } diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index bff9ed6f4e..1dfb599083 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -478,8 +478,6 @@ export class WorkflowExecute { onCancel.shouldReject = false; onCancel(() => { - console.log('got cancellled'); - gotCancel = true; });