From 34c48299d1de901f9a27d5c71213b1b48e6ed53c Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 2 Oct 2020 15:17:15 +0200 Subject: [PATCH] Report Some jobs have not finished only if there are no other errors --- src/Parallel/ParallelAnalyser.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Parallel/ParallelAnalyser.php b/src/Parallel/ParallelAnalyser.php index 1aebce8e6d..7160e10716 100644 --- a/src/Parallel/ParallelAnalyser.php +++ b/src/Parallel/ParallelAnalyser.php @@ -181,7 +181,7 @@ public function analyse( $job = array_pop($jobs); $process->request(['action' => 'analyse', 'files' => $job]); - }, $handleError, function ($exitCode, string $output) use (&$internalErrors, $processIdentifier): void { + }, $handleError, function ($exitCode, string $output) use (&$internalErrors, &$internalErrorsCount, $processIdentifier): void { $this->processPool->tryQuitProcess($processIdentifier); if ($exitCode === 0) { return; @@ -191,14 +191,15 @@ public function analyse( } $internalErrors[] = sprintf('Child process error (exit code %d): %s', $exitCode, $output); + $internalErrorsCount++; }); $this->processPool->attachProcess($processIdentifier, $process); } $loop->run(); - if (count($jobs) > 0) { - $internalErrors[] = 'Some parallel worker jobs have not finished'; + if (count($jobs) > 0 && $internalErrorsCount === 0) { + $internalErrors[] = 'Some parallel worker jobs have not finished.'; $internalErrorsCount++; }