mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Nac polling improvement (#16265)
* Nac polling improvement Was loading all nac entries from the DB, then filtering them. Now it only loads non-historical entries off the bat. All this because the filter was returning the wrong type... * Add missing get
This commit is contained in:
@@ -81,11 +81,9 @@ class Nac implements Module
|
|||||||
|
|
||||||
$nac_entries = $os->pollNac()->keyBy('mac_address');
|
$nac_entries = $os->pollNac()->keyBy('mac_address');
|
||||||
//filter out historical entries
|
//filter out historical entries
|
||||||
$existing_entries = $os->getDevice()->portsNac->keyBy('mac_address')->filter(function ($value, $key) {
|
$existing_entries = $os->getDevice()->portsNac()
|
||||||
if ($value['historical'] == 0) {
|
->where('historical', 0)
|
||||||
return $value;
|
->get()->keyBy('mac_address');
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// update existing models
|
// update existing models
|
||||||
foreach ($nac_entries as $nac_entry) {
|
foreach ($nac_entries as $nac_entry) {
|
||||||
|
Reference in New Issue
Block a user