From 13cd3eb1ac5cbb1709d1a0ca14f12ed0631b902d Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Thu, 1 Aug 2024 19:40:27 +0200 Subject: [PATCH] clean up comments again --- packages/cli/new-partial-execution | 0 packages/cli/package.json | 2 +- packages/cli/src/License.ts | 2 -- packages/cli/src/WorkflowRunner.ts | 31 ++++++++---------------------- 4 files changed, 9 insertions(+), 26 deletions(-) delete mode 100644 packages/cli/new-partial-execution diff --git a/packages/cli/new-partial-execution b/packages/cli/new-partial-execution deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/cli/package.json b/packages/cli/package.json index 1f50e25e994c8..ca8f192e40152 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,7 +21,7 @@ "lint": "eslint . --quiet", "lintfix": "eslint . --fix", "start": "run-script-os", - "start:default": "node --inspect bin/n8n", + "start:default": "cd bin && ./n8n", "start:windows": "cd bin && n8n", "test": "pnpm test:sqlite", "test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest", diff --git a/packages/cli/src/License.ts b/packages/cli/src/License.ts index d20dfbd6bebf6..9a2740ce7cbb7 100644 --- a/packages/cli/src/License.ts +++ b/packages/cli/src/License.ts @@ -230,7 +230,6 @@ export class License { } isFeatureEnabled(feature: BooleanLicenseFeature) { - return true; return this.manager?.hasFeatureEnabled(feature) ?? false; } @@ -363,7 +362,6 @@ export class License { } getTeamProjectLimit() { - return UNLIMITED_LICENSE_QUOTA; return this.getFeatureValue(LICENSE_QUOTAS.TEAM_PROJECT_LIMIT) ?? 0; } diff --git a/packages/cli/src/WorkflowRunner.ts b/packages/cli/src/WorkflowRunner.ts index 9baa487284e34..14787ecb92d4a 100644 --- a/packages/cli/src/WorkflowRunner.ts +++ b/packages/cli/src/WorkflowRunner.ts @@ -111,11 +111,12 @@ export class WorkflowRunner { } } - /** Run the workflow */ + /** Run the workflow + * @param realtime This is used in queue mode to change the priority of an execution, making sure they are picked up quicker. + */ async run( data: IWorkflowExecutionDataProcess, loadStaticData?: boolean, - // TODO: Figure out what this is for realtime?: boolean, restartExecutionId?: string, responsePromise?: IDeferredPromise, @@ -141,7 +142,6 @@ export class WorkflowRunner { this.activeExecutions.attachResponsePromise(executionId, responsePromise); } - // NOTE: queue mode if (this.executionsMode === 'queue' && data.executionMode !== 'manual') { // Do not run "manual" executions in bull because sending events to the // frontend would not be possible @@ -202,9 +202,8 @@ export class WorkflowRunner { ): Promise { const workflowId = data.workflowData.id; if (loadStaticData === true && workflowId) { - // TODO: Can we assign static data to a variable instead of mutating `data`? - // NOTE: This is the workflow and node specific data that can be saved - // and retrieved with the code node. + // This is the workflow and node specific data that can be saved and + // retrieved with the code node. data.workflowData.staticData = await this.workflowStaticDataService.getStaticDataById(workflowId); } @@ -222,8 +221,6 @@ export class WorkflowRunner { let pinData: IPinData | undefined; if (data.executionMode === 'manual') { - // TODO: Find out why pin data exists on both objects and if we need both - // or if one can be cleaned up. pinData = data.pinData ?? data.workflowData.pinData; } @@ -238,8 +235,6 @@ export class WorkflowRunner { settings: workflowSettings, pinData, }); - // NOTE: This seems like a catchall so we can pass anything deep into the - // workflow execution engine. const additionalData = await WorkflowExecuteAdditionalData.getBase( data.userId, undefined, @@ -255,8 +250,6 @@ export class WorkflowRunner { { executionId }, ); let workflowExecution: PCancelable; - // NOTE: This is were we update the status of the execution in the - // database. And this is where the race condition happens. await this.executionRepository.updateStatus(executionId, 'running'); try { @@ -268,8 +261,6 @@ export class WorkflowRunner { }, ]; - // TODO: Why the detour through the WorkflowExecuteAdditionalData to call - // ActiveExecutions? additionalData.setExecutionStatus = WorkflowExecuteAdditionalData.setExecutionStatus.bind({ executionId, }); @@ -279,12 +270,7 @@ export class WorkflowRunner { }); if (data.executionData !== undefined) { - // TODO: What's the difference between `data.executionData` and `data.runData`? - // I think this is the data coming from a webhook or a trigger, e.g. the - // body of a POST request or the message of a queue message. - console.trace('data.executionData', JSON.stringify(data.executionData, null, 2)); - - console.debug(`Execution ID ${executionId} had Execution data. Running with payload.`, { + this.logger.debug(`Execution ID ${executionId} had Execution data. Running with payload.`, { executionId, }); const workflowExecute = new WorkflowExecute( @@ -299,7 +285,7 @@ export class WorkflowRunner { data.startNodes.length === 0 ) { // Full Execution - console.debug(`Execution ID ${executionId} will run executing all nodes.`, { + this.logger.debug(`Execution ID ${executionId} will run executing all nodes.`, { executionId, }); // Execute all nodes @@ -316,12 +302,11 @@ export class WorkflowRunner { ); } else { // Partial Execution - console.debug(`Execution ID ${executionId} is a partial execution.`, { executionId }); + this.logger.debug(`Execution ID ${executionId} is a partial execution.`, { executionId }); // Execute only the nodes between start and destination nodes const workflowExecute = new WorkflowExecute(additionalData, data.executionMode); if (data.partialExecutionVersion === '1') { - console.debug('new partial execution is enabled'); workflowExecution = workflowExecute.runPartialWorkflow2( workflow, data.runData,