mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Support multiple daily process locking backends with distributed polling (#11896)
* Implement locks in the file cache * Replace custom locks * implement restore lock Used when re-hydrating * remove legacy use statements * Add class descriptions * Fix style * Default to database cache driver * missed cache_locks table prevent chicken-egg issue * style fixes * Remove custom file lock implementation * missed items from file cache * Update schema definition hmm, other schema noise must be from manual modification as this is generated from a freshly migrated db. * require predis, it is pure python, so no harm in adding * and set predis as the default client
This commit is contained in:
@@ -8,9 +8,6 @@
|
||||
*
|
||||
* @copyright (C) 2006 - 2012 Adam Armstrong
|
||||
*/
|
||||
|
||||
use LibreNMS\Util\FileLock;
|
||||
|
||||
$init_modules = ['discovery'];
|
||||
require __DIR__ . '/includes/init.php';
|
||||
|
||||
@@ -33,7 +30,7 @@ if (isset($options['h'])) {
|
||||
$where = ' ';
|
||||
$doing = 'all';
|
||||
} elseif ($options['h'] == 'new') {
|
||||
$new_discovery_lock = FileLock::lockOrDie('new-discovery');
|
||||
$new_discovery_lock = Cache::lock('new-discovery', 300);
|
||||
$where = 'AND `last_discovered` IS NULL';
|
||||
$doing = 'new';
|
||||
} elseif ($options['h']) {
|
||||
@@ -138,7 +135,7 @@ if ($discovered_devices) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($doing === 'new') {
|
||||
if (isset($new_discovery_lock)) {
|
||||
$new_discovery_lock->release();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user