From c71027fbfbd74a025c90e73b8f273c2334a090a7 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Fri, 12 May 2023 20:22:51 -0400 Subject: [PATCH] fix(core): set max listeners to avoid warning when running high numbers of parallel tasks (#16993) --- packages/nx/src/tasks-runner/task-orchestrator.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/tasks-runner/task-orchestrator.ts b/packages/nx/src/tasks-runner/task-orchestrator.ts index d2927c9935..e7eb6e6c6d 100644 --- a/packages/nx/src/tasks-runner/task-orchestrator.ts +++ b/packages/nx/src/tasks-runner/task-orchestrator.ts @@ -1,5 +1,7 @@ -import { Workspaces } from '../config/workspaces'; +import { defaultMaxListeners } from 'events'; import { performance } from 'perf_hooks'; + +import { Workspaces } from '../config/workspaces'; import { Hasher } from '../hasher/hasher'; import { ForkedProcessTaskRunner } from './forked-process-task-runner'; import { workspaceRoot } from '../utils/workspace-root'; @@ -65,6 +67,9 @@ export class TaskOrchestrator { const threads = []; + process.stdout.setMaxListeners(this.options.parallel + defaultMaxListeners); + process.stderr.setMaxListeners(this.options.parallel + defaultMaxListeners); + // initial seeding of the queue for (let i = 0; i < this.options.parallel; ++i) { threads.push(this.executeNextBatchOfTasksUsingTaskSchedule());