diff --git a/src/Command/AnalyserRunner.php b/src/Command/AnalyserRunner.php index c452ba4976d..8e4cf18401e 100644 --- a/src/Command/AnalyserRunner.php +++ b/src/Command/AnalyserRunner.php @@ -71,7 +71,7 @@ public function runAnalyser( ); } - $schedule = $this->scheduler->scheduleWork($this->cpuCoreCounter->getNumberOfCpuCores(), $files); + $schedule = $this->scheduler->scheduleWork($this->cpuCoreCounter->getNumberOfCpuCores(), $files, $debug); $mainScript = null; if (isset($_SERVER['argv'][0]) && is_file($_SERVER['argv'][0])) { $mainScript = $_SERVER['argv'][0]; diff --git a/src/Parallel/Scheduler.php b/src/Parallel/Scheduler.php index 879cdcc5f5f..9853a4d394d 100644 --- a/src/Parallel/Scheduler.php +++ b/src/Parallel/Scheduler.php @@ -42,10 +42,11 @@ public function __construct( public function scheduleWork( int $cpuCores, array $files, + bool $debug ): Schedule { $jobs = array_chunk($files, $this->jobSize); - $numberOfProcesses = min( + $numberOfProcesses = $debug ? 1 : min( max((int) floor(count($jobs) / $this->minimumNumberOfJobsPerProcess), 1), $cpuCores, );