Skip to content

Commit

Permalink
fix(core): schedule tasks with the most tasks that depend on it first (
Browse files Browse the repository at this point in the history
…#12967)

(cherry picked from commit 59ed6f1)
  • Loading branch information
skrtheboss authored and FrozenPandaz committed Nov 7, 2022
1 parent ba7a850 commit 2a980c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/nx/src/tasks-runner/tasks-schedule.ts
Expand Up @@ -99,7 +99,14 @@ export class TasksSchedule {
[taskId]
);
this.options.lifeCycle.scheduleTask(task);
this.scheduledTasks.push(taskId);
this.scheduledTasks = this.scheduledTasks
.concat(taskId)
// NOTE: sort task by most dependent on first
.sort(
(taskId1, taskId2) =>
this.reverseTaskDeps[taskId2].length -
this.reverseTaskDeps[taskId1].length
);
}

private scheduleBatches() {
Expand Down

0 comments on commit 2a980c2

Please sign in to comment.