Permalink
Browse files

Make failed? method return a bool.

  • Loading branch information...
1 parent 360618a commit 608dc1ba96cdd339da551b43f74baad910d5b317 @mcfiredrill committed Feb 20, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/delayed/backend/base.rb
  2. +1 −1 spec/delayed/backend/test.rb
@@ -61,7 +61,7 @@ def work_off(num = 100)
end
def failed?
- failed_at
+ !failed_at.blank?
end
alias_method :failed, :failed?
@@ -58,7 +58,7 @@ def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_ti
jobs = all.select do |j|
j.run_at <= db_time_now &&
(j.locked_at.nil? || j.locked_at < db_time_now - max_run_time || j.locked_by == worker_name) &&
- j.failed_at.nil?
+ !j.failed?
end
jobs = jobs.select{|j| Worker.queues.include?(j.queue)} if Worker.queues.any?

0 comments on commit 608dc1b

Please sign in to comment.