mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Add a new locking framework that uses flock. (#6858)
Change locks to use flock, as pid checking is not sufficient when PID Namespaces are involved.
This commit is contained in:
committed by
Tony Murray
parent
f02b551145
commit
701fbbc29b
@@ -33,7 +33,7 @@ if (isset($options['h'])) {
|
||||
$where = ' ';
|
||||
$doing = 'all';
|
||||
} elseif ($options['h'] == 'new') {
|
||||
set_lock('new-discovery');
|
||||
$new_discovery_lock = \LibreNMS\FileLock::lockOrDie('new-discovery');
|
||||
$where = 'AND `last_discovered` IS NULL';
|
||||
$doing = 'new';
|
||||
} elseif ($options['h']) {
|
||||
@@ -140,10 +140,13 @@ if ($discovered_devices) {
|
||||
if ($doing === 'new') {
|
||||
// We have added a new device by this point so we might want to do some other work
|
||||
oxidized_reload_nodes();
|
||||
release_lock('new-discovery');
|
||||
}
|
||||
}
|
||||
|
||||
if ($doing === 'new') {
|
||||
$new_discovery_lock->release();
|
||||
}
|
||||
|
||||
$string = $argv[0]." $doing ".date($config['dateformat']['compact'])." - $discovered_devices devices discovered in $proctime secs";
|
||||
d_echo("$string\n");
|
||||
|
||||
|
Reference in New Issue
Block a user