fix(core): set max listeners to avoid warning when running high numbers of parallel tasks (#16993)

This commit is contained in:
Craigory Coppola 2023-05-12 20:22:51 -04:00 committed by GitHub
parent b2470de56c
commit c71027fbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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());