lib/cloud_crowd/models/work_unit.rb in cloud-crowd-0.7.3 vs lib/cloud_crowd/models/work_unit.rb in cloud-crowd-0.7.5

- old
+ new

@@ -77,10 +77,10 @@ # were none available. def self.reserve_available(options={}) reservation = SecureRandom.random_number(MAX_RESERVATION) conditions = "reservation is null and node_record_id is null and status in (#{INCOMPLETE.join(',')}) and #{options[:conditions]}" query = WorkUnit.where(conditions) - query.limit(options[:limit]) if options[:limit] + query = query.limit(options[:limit]) if options[:limit] any = query.update_all("reservation = #{reservation}") > 0 any && reservation end # Cancels all outstanding WorkUnit reservations for this process.