Skip to content

Commit

Permalink
Report Some jobs have not finished only if there are no other errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 2, 2020
1 parent 6c61e49 commit 34c4829
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Parallel/ParallelAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++;
}

Expand Down

0 comments on commit 34c4829

Please sign in to comment.