Skip to content

Commit

Permalink
MongoMapper can't assume that the inputs are of an Integer type
Browse files Browse the repository at this point in the history
  • Loading branch information
zbelzer authored and bkeepers committed Apr 9, 2010
1 parent dafd5f4 commit 14be7a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/delayed/backend/mongo_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_ti

where = "this.locked_at == null || this.locked_at < #{make_date(right_now - max_run_time)}"

(conditions[:priority] ||= {})['$gte'] = Worker.min_priority if Worker.min_priority
(conditions[:priority] ||= {})['$lte'] = Worker.max_priority if Worker.max_priority
(conditions[:priority] ||= {})['$gte'] = Worker.min_priority.to_i if Worker.min_priority
(conditions[:priority] ||= {})['$lte'] = Worker.max_priority.to_i if Worker.max_priority

results = all(conditions.merge(:locked_by => worker_name))
results += all(conditions.merge('$where' => where)) if results.size < limit
Expand Down

0 comments on commit 14be7a2

Please sign in to comment.