increment deferrals field when job is deferred

This commit is contained in:
Oliver Gorwits
2017-05-23 08:58:57 +01:00
parent 88ae9c00ba
commit e7c22e7d11
2 changed files with 25 additions and 1 deletions

View File

@@ -189,11 +189,16 @@ sub jq_lock {
sub jq_defer {
my $job = shift;
my $fqdn = hostfqdn || 'localhost';
my $happy = false;
try {
# lock db row and update to show job is available
schema('netdisco')->txn_do(sub {
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
backend => $fqdn, device => $job->device, action => $job->action,
},{ key => 'device_skip_pkey' })->increment_deferrals;
# lock db row and update to show job is available
schema('netdisco')->resultset('Admin')
->find($job->job, {for => 'update'})
->update({ status => 'queued', started => undef });