Skip to content

Commit

Permalink
Fixing a subtle but very serious bug limiting # of work_units snagged…
Browse files Browse the repository at this point in the history
… to distribute at any one time.
  • Loading branch information
knowtheory committed Feb 5, 2015
1 parent 5fc39a0 commit 3e2cc1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cloud_crowd/models/work_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ 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
Expand Down

0 comments on commit 3e2cc1d

Please sign in to comment.