mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Use memcached to lock daily processes on Distributed Pollers (#7735)
* fix: use memcached to lock daily processes on Distributed Pollers * All the locks!
This commit is contained in:
committed by
Neil Lathwood
parent
9c0a74debb
commit
2e73b75297
@@ -43,6 +43,11 @@ class Proc
|
||||
*/
|
||||
private $_synchronous;
|
||||
|
||||
/**
|
||||
* @var int|null hold the exit code, we can only get this on the first process_status after exit
|
||||
*/
|
||||
private $_exitcode = null;
|
||||
|
||||
/**
|
||||
* Create and run a new process
|
||||
* Most arguments match proc_open()
|
||||
@@ -217,7 +222,13 @@ class Proc
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return proc_get_status($this->_process);
|
||||
$status = proc_get_status($this->_process);
|
||||
|
||||
if ($status['running'] === false && is_null($this->_exitcode)) {
|
||||
$this->_exitcode = $status['exitcode'];
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +242,18 @@ class Proc
|
||||
return false;
|
||||
}
|
||||
$st = $this->getStatus();
|
||||
return isset($st['running']);
|
||||
return isset($st['running']) && $st['running'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exit code from the process.
|
||||
* Will return null unless isRunning() or getStatus() has been run and returns false.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getExitCode()
|
||||
{
|
||||
return $this->_exitcode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user