remove any duplicate jobs when locking
This commit is contained in:
@@ -109,6 +109,15 @@ sub jq_lock {
|
||||
schema('netdisco')->resultset('Admin')
|
||||
->find($job->id, {for => 'update'})
|
||||
->update({ status => "queued-$fqdn" });
|
||||
|
||||
# remove any duplicate jobs, needed because we have race conditions
|
||||
# when queueing jobs of a type for all devices
|
||||
schema('netdisco')->resultset('Admin')->search({
|
||||
device => $job->device,
|
||||
port => $job->port,
|
||||
action => $job->action,
|
||||
subaction => $job->subaction,
|
||||
}, {for => 'update'})->delete();
|
||||
});
|
||||
$happy = true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user