mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Pause polling and discovery if there's an update-lock
This commit is contained in:
@@ -105,6 +105,13 @@ if ($config['distributed_poller'] === true) {
|
|||||||
$where .= ' AND poller_group IN('.$config['distributed_poller_group'].')';
|
$where .= ' AND poller_group IN('.$config['distributed_poller_group'].')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo 'Checking for MySQL Locks:';
|
||||||
|
while (!dbCheckLock('schema_update')) {
|
||||||
|
echo '.';
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
|
|
||||||
foreach (dbFetch("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC") as $device) {
|
foreach (dbFetch("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC") as $device) {
|
||||||
if (dbGetLock('discovering.' . $device['device_id'])) {
|
if (dbGetLock('discovering.' . $device['device_id'])) {
|
||||||
discover_device($device, $options);
|
discover_device($device, $options);
|
||||||
|
@@ -98,10 +98,6 @@ if (!dbGetLock('schema_update')) {
|
|||||||
|
|
||||||
register_shutdown_function('dbReleaseLock','schema_update');
|
register_shutdown_function('dbReleaseLock','schema_update');
|
||||||
|
|
||||||
do {
|
|
||||||
sleep(1);
|
|
||||||
} while (@dbFetchCell('SELECT COUNT(*) FROM `devices` WHERE NOT IS_FREE_LOCK(CONCAT("polling.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("queued.", device_id)) OR NOT IS_FREE_LOCK(CONCAT("discovering.", device_id))') > 0);
|
|
||||||
|
|
||||||
foreach ($filelist as $file) {
|
foreach ($filelist as $file) {
|
||||||
list($filename,$extension) = explode('.', $file, 2);
|
list($filename,$extension) = explode('.', $file, 2);
|
||||||
if ($filename > $db_rev) {
|
if ($filename > $db_rev) {
|
||||||
@@ -171,3 +167,5 @@ if ($updating) {
|
|||||||
|
|
||||||
echo "-- Done\n";
|
echo "-- Done\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbReleaseLock('schema_update');
|
||||||
|
@@ -100,6 +100,13 @@ if (isset($options['r'])) {
|
|||||||
$config['norrd'] = true;
|
$config['norrd'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo 'Checking for MySQL Locks:';
|
||||||
|
while (!dbCheckLock('schema_update')) {
|
||||||
|
echo '.';
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
|
|
||||||
rrdtool_pipe_open($rrd_process, $rrd_pipes);
|
rrdtool_pipe_open($rrd_process, $rrd_pipes);
|
||||||
|
|
||||||
echo "Starting polling run:\n\n";
|
echo "Starting polling run:\n\n";
|
||||||
|
Reference in New Issue
Block a user