mirror of https://github.com/MISP/MISP
fix: [jobs] Correctly handle incorrectly configured simple background jobs
parent
2845a755cc
commit
72c05c314d
|
@ -3568,6 +3568,11 @@ class Server extends AppModel
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $workerIssueCount
|
||||||
|
* @return array
|
||||||
|
* @throws ProcessException
|
||||||
|
*/
|
||||||
public function workerDiagnostics(&$workerIssueCount)
|
public function workerDiagnostics(&$workerIssueCount)
|
||||||
{
|
{
|
||||||
$worker_array = array(
|
$worker_array = array(
|
||||||
|
@ -3583,13 +3588,18 @@ class Server extends AppModel
|
||||||
unset($worker_array['scheduler']);
|
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();
|
$currentUser = ProcessTool::whoami();
|
||||||
$procAccessible = file_exists('/proc');
|
$procAccessible = file_exists('/proc');
|
||||||
foreach ($workers as $pid => $worker) {
|
foreach ($workers as $pid => $worker) {
|
||||||
if (!is_numeric($pid)) {
|
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'];
|
$entry = $worker['type'] === 'regular' ? $worker['queue'] : $worker['type'];
|
||||||
$correctUser = ($currentUser === $worker['user']);
|
$correctUser = ($currentUser === $worker['user']);
|
||||||
|
|
Loading…
Reference in New Issue