[#217] find changed to search to handle missing row in queue
This commit is contained in:
		| @@ -9,6 +9,7 @@ | ||||
|  | ||||
|   * [#211] Additional check for undefined SNMP::Info instance | ||||
|   * [#212] Discover SQL error on returning multiple rows | ||||
|   * [#217] find changed to search to handle missing row in queue | ||||
|   * Re-set hostname on device after renumber | ||||
|  | ||||
| 2.032002 - 2015-04-03 | ||||
|   | ||||
| @@ -107,9 +107,13 @@ sub jq_lock { | ||||
|   try { | ||||
|     schema('netdisco')->txn_do(sub { | ||||
|       schema('netdisco')->resultset('Admin') | ||||
|         ->find($job->job, {for => 'update'}) | ||||
|         ->search({job => $job->job}, {for => 'update'}) | ||||
|         ->update({ status => "queued-$fqdn" }); | ||||
|  | ||||
|       return unless | ||||
|         schema('netdisco')->resultset('Admin') | ||||
|           ->count({job => $job->job, 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({ | ||||
| @@ -119,8 +123,9 @@ sub jq_lock { | ||||
|         action    => $job->action, | ||||
|         subaction => $job->subaction, | ||||
|       }, {for => 'update'})->delete(); | ||||
|  | ||||
|       $happy = true; | ||||
|     }); | ||||
|     $happy = true; | ||||
|   } | ||||
|   catch { | ||||
|     error $_; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user