Skip to content

Commit

Permalink
clean up comments again
Browse files Browse the repository at this point in the history
  • Loading branch information
despairblue committed Aug 1, 2024
1 parent 8c0f105 commit 13cd3eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 26 deletions.
Empty file removed packages/cli/new-partial-execution
Empty file.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/src/License.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export class License {
}

isFeatureEnabled(feature: BooleanLicenseFeature) {
return true;
return this.manager?.hasFeatureEnabled(feature) ?? false;
}

Expand Down Expand Up @@ -363,7 +362,6 @@ export class License {
}

getTeamProjectLimit() {
return UNLIMITED_LICENSE_QUOTA;
return this.getFeatureValue(LICENSE_QUOTAS.TEAM_PROJECT_LIMIT) ?? 0;
}

Expand Down
31 changes: 8 additions & 23 deletions packages/cli/src/WorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<IExecuteResponsePromiseData>,
Expand All @@ -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
Expand Down Expand Up @@ -202,9 +202,8 @@ export class WorkflowRunner {
): Promise<void> {
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);
}
Expand All @@ -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;
}

Expand All @@ -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,
Expand All @@ -255,8 +250,6 @@ export class WorkflowRunner {
{ executionId },
);
let workflowExecution: PCancelable<IRun>;
// 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 {
Expand All @@ -268,8 +261,6 @@ export class WorkflowRunner {
},
];

// TODO: Why the detour through the WorkflowExecuteAdditionalData to call
// ActiveExecutions?
additionalData.setExecutionStatus = WorkflowExecuteAdditionalData.setExecutionStatus.bind({
executionId,
});
Expand All @@ -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(
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 13cd3eb

Please sign in to comment.