« blib/lib/App/Netdisco/Worker/Plugin/Internal/BackendFQDN.pm
↑ Summary
blib/lib/App/Netdisco/Worker/Plugin/Linter.pm »
| 1 | package App::Netdisco::Worker::Plugin::Internal::SNMPFastDiscover; | ||
| 2 | |||
| 3 | use Dancer ':syntax'; | ||
| 4 | use App::Netdisco::Worker::Plugin; | ||
| 5 | use aliased 'App::Netdisco::Worker::Status'; | ||
| 6 | |||
| 7 | use Scalar::Util 'blessed'; | ||
| 8 | |||
| 9 | register_worker({ phase => 'check', driver => 'direct' }, sub { | ||
| 10 | my ($job, $workerconf) = @_; | ||
| 11 | |||
| 12 | # if the job is a queued job, and discover, and the first one... | ||
| 13 | if ($job->job and $job->action eq 'discover' and not $job->log | ||
| 14 | and (not blessed $job->device or not $job->device->in_storage)) { | ||
| 15 | |||
| 16 | config->{'snmp_try_slow_connect'} = false; | ||
| 17 | debug "running with fast SNMP timeouts for initial discover"; | ||
| 18 | } | ||
| 19 | else { | ||
| 20 | debug "running with configured SNMP timeouts"; | ||
| 21 | } | ||
| 22 | }); | ||
| 23 | |||
| 24 | true; |