From 14be7a2412c7c0b3f3d27a000166d38fcd4afff0 Mon Sep 17 00:00:00 2001 From: Zachary Belzer Date: Wed, 31 Mar 2010 02:29:12 +0800 Subject: [PATCH] MongoMapper can't assume that the inputs are of an Integer type --- lib/delayed/backend/mongo_mapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/delayed/backend/mongo_mapper.rb b/lib/delayed/backend/mongo_mapper.rb index 978188bac..6f8196dd1 100644 --- a/lib/delayed/backend/mongo_mapper.rb +++ b/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