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:
Tony Murray
2020-10-07 07:36:35 -05:00
committed by GitHub
parent e52531fba4
commit 1e4702fa4f
17 changed files with 235 additions and 560 deletions

View File

@@ -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();
}