[#159] Macsuck archive behaviour same as ND1 (unseen nodes remain active)

This commit is contained in:
Oliver Gorwits
2014-11-14 23:55:25 +00:00
parent a308d1a177
commit 1f7fe169ec
4 changed files with 26 additions and 4 deletions

View File

@@ -112,10 +112,15 @@ sub do_macsuck {
$ip, $total_nodes;
# a use for $now ... need to archive dissapeared nodes
my $archived = schema('netdisco')->resultset('Node')->search({
switch => $ip,
time_last => { '<' => \$now },
})->update({ active => \'false' });
my $archived = 0;
if (setting('node_freshness')) {
$archived = schema('netdisco')->resultset('Node')->search({
switch => $ip,
time_last => \[ "< ($now - ?::interval)",
setting('node_freshness') .' minutes' ],
})->update({ active => \'false' });
}
debug sprintf ' [%s] macsuck - removed %d fwd table entries to archive',
$ip, $archived;