Skip to content

Commit a3acfd6

Browse files
committed
fix(core): treat undefined task parallelism as parallel when scheduling (#35736)
## Current Behavior When deciding whether a task can be scheduled, `TasksSchedule` checked `task.parallelism === true` in two places: - `canBeScheduled` — gating a task against already-running parallel tasks - `canBatchTaskBeScheduled` — gating a task for batch scheduling A task whose `parallelism` is `undefined` failed both checks and was blocked, even though `undefined` is meant to mean "parallel". This was also inconsistent with the running-tasks check, which uses `parallelism === false` — treating `undefined` as parallel-capable. ## Expected Behavior A task with `parallelism === undefined` is treated as parallel in both the regular and batch scheduling checks. Both now use `parallelism !== false`, matching the convention used elsewhere and the documented default. ## Related Issue(s) N/A (cherry picked from commit 05c5589)
1 parent 81bdb17 commit a3acfd6

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/nx/src/tasks-runner/tasks-schedule.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ export class TasksSchedule {
319319
task: Task,
320320
batchTaskGraph: TaskGraph | undefined
321321
): boolean {
322-
// task self needs to have parallelism true
322+
// task self needs to support parallelism (undefined defaults to parallel)
323323
// all deps have either completed or belong to the same batch
324324
return (
325-
task.parallelism === true &&
325+
task.parallelism !== false &&
326326
this.taskGraph.dependencies[task.id].every(
327327
(id) => this.completedTasks.has(id) || !!batchTaskGraph?.tasks[id]
328328
)
@@ -358,7 +358,7 @@ export class TasksSchedule {
358358
return false;
359359
} else {
360360
// if all running tasks support parallelism, can only schedule task with parallelism
361-
return this.taskGraph.tasks[taskId].parallelism === true;
361+
return this.taskGraph.tasks[taskId].parallelism !== false;
362362
}
363363
}
364364

0 commit comments

Comments
 (0)