mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Add another safety-net to remove locks if the execution of poller/disco gets aborted or killed
This commit is contained in:
@@ -114,6 +114,7 @@ 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'])) {
|
||||||
|
register_shutdown_function('dbReleaseLock','discovering.'.$device['device_id']);
|
||||||
discover_device($device, $options);
|
discover_device($device, $options);
|
||||||
dbReleaseLock('discovering.' . $device['device_id']);
|
dbReleaseLock('discovering.' . $device['device_id']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ if (!isset($query)) {
|
|||||||
foreach (dbFetch($query) as $device) {
|
foreach (dbFetch($query) as $device) {
|
||||||
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'");
|
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'");
|
||||||
if (dbGetLock('polling.' . $device['device_id'])) {
|
if (dbGetLock('polling.' . $device['device_id'])) {
|
||||||
|
register_shutdown_function('dbReleaseLock','polling.'.$device['device_id']);
|
||||||
poll_device($device, $options);
|
poll_device($device, $options);
|
||||||
RunRules($device['device_id']);
|
RunRules($device['device_id']);
|
||||||
echo "\r\n";
|
echo "\r\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user