refactor: Added lock support to ./discovery.php -h new to prevent overlap (#6568)

This commit is contained in:
Neil Lathwood
2017-05-04 02:23:45 +01:00
committed by Tony Murray
parent a475069c9b
commit 5f6279d28c

View File

@@ -33,6 +33,7 @@ if (isset($options['h'])) {
$where = ' ';
$doing = 'all';
} elseif ($options['h'] == 'new') {
set_lock('new-discovery');
$where = 'AND `last_discovered` IS NULL';
$doing = 'new';
} elseif ($options['h']) {
@@ -137,6 +138,7 @@ 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');
}
}