Files
netdisco/lib/App/Netdisco/Worker/Plugin/Internal/SNMPFastDiscover.pm
2023-08-11 13:28:55 +01:00

24 lines
720 B
Perl
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package App::Netdisco::Worker::Plugin::Internal::SNMPFastDiscover;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
use Scalar::Util 'blessed';
register_worker({ phase => 'check', driver => 'direct' }, sub {
my ($job, $workerconf) = @_;
# if the job is a queued job, and discover, and the first one...
if ($job->job and $job->action eq 'discover' and not $job->log
and (not blessed $job->device or not $job->device->in_storage)) {
config->{'snmp_try_slow_connect'} = false;
return Status->info("-> running with fast SNMP timeouts for initial discover");
}
return Status->info("-> running with configured SNMP timeouts");
});
true;