reset deferrals counter on successful SNMP connect
This commit is contained in:
@@ -225,11 +225,23 @@ sub jq_defer {
|
|||||||
|
|
||||||
sub jq_complete {
|
sub jq_complete {
|
||||||
my $job = shift;
|
my $job = shift;
|
||||||
|
$fqdn ||= (hostfqdn || 'localhost');
|
||||||
my $happy = false;
|
my $happy = false;
|
||||||
|
|
||||||
# lock db row and update to show job is done/error
|
# lock db row and update to show job is done/error
|
||||||
|
|
||||||
|
# now that SNMP connect failures are deferrals and not errors, any complete
|
||||||
|
# status, whether success or failure, indicates an SNMP connect. reset the
|
||||||
|
# connection failures counter to forget oabout occasional connect glitches.
|
||||||
|
|
||||||
try {
|
try {
|
||||||
schema('netdisco')->txn_do(sub {
|
schema('netdisco')->txn_do(sub {
|
||||||
|
if ($job->device) {
|
||||||
|
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
||||||
|
backend => $fqdn, device => $job->device,
|
||||||
|
},{ key => 'device_skip_pkey' })->update({ deferrals => 0 });
|
||||||
|
}
|
||||||
|
|
||||||
schema('netdisco')->resultset('Admin')
|
schema('netdisco')->resultset('Admin')
|
||||||
->find($job->job, {for => 'update'})->update({
|
->find($job->job, {for => 'update'})->update({
|
||||||
status => $job->status,
|
status => $job->status,
|
||||||
|
|||||||
Reference in New Issue
Block a user