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:
Tony Murray
2024-08-02 20:44:47 -05:00
committed by GitHub
parent 2d2ddddd5d
commit a61cd16f86

View File

@@ -81,11 +81,9 @@ class Nac implements Module
$nac_entries = $os->pollNac()->keyBy('mac_address');
//filter out historical entries
$existing_entries = $os->getDevice()->portsNac->keyBy('mac_address')->filter(function ($value, $key) {
if ($value['historical'] == 0) {
return $value;
}
});
$existing_entries = $os->getDevice()->portsNac()
->where('historical', 0)
->get()->keyBy('mac_address');
// update existing models
foreach ($nac_entries as $nac_entry) {