Permalink
Browse files

MongoMapper can't assume that the inputs are of an Integer type

  • Loading branch information...
1 parent dafd5f4 commit 14be7a2412c7c0b3f3d27a000166d38fcd4afff0 @zbelzer zbelzer committed with bkeepers Mar 30, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/delayed/backend/mongo_mapper.rb
View
4 lib/delayed/backend/mongo_mapper.rb
@@ -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

0 comments on commit 14be7a2

Please sign in to comment.