fix: [jobs] Correctly handle incorrectly configured simple background jobs

pull/8659/head
Jakub Onderka 2022-10-11 09:30:19 +02:00
parent 2845a755cc
commit 72c05c314d
1 changed files with 12 additions and 2 deletions

View File

@ -3568,6 +3568,11 @@ class Server extends AppModel
];
}
/**
* @param int $workerIssueCount
* @return array
* @throws ProcessException
*/
public function workerDiagnostics(&$workerIssueCount)
{
$worker_array = array(
@ -3583,13 +3588,18 @@ class Server extends AppModel
unset($worker_array['scheduler']);
}
$workers = $this->getWorkers();
try {
$workers = $this->getWorkers();
} catch (Exception $e) {
$this->logException('Could not get list of workers.', $e);
return $worker_array;
}
$currentUser = ProcessTool::whoami();
$procAccessible = file_exists('/proc');
foreach ($workers as $pid => $worker) {
if (!is_numeric($pid)) {
throw new MethodNotAllowedException('Non numeric PID found.');
throw new Exception('Non numeric PID found.');
}
$entry = $worker['type'] === 'regular' ? $worker['queue'] : $worker['type'];
$correctUser = ($currentUser === $worker['user']);