diff --git a/lib/hirefireapp/middleware.rb b/lib/hirefireapp/middleware.rb index c58302c..9540360 100644 --- a/lib/hirefireapp/middleware.rb +++ b/lib/hirefireapp/middleware.rb @@ -91,11 +91,11 @@ def count_delayed_job where(:failed_at => nil). where('run_at <= ?', Time.now).count else - Delayed::Job.all( + Delayed::Job.count(:id, :conditions => [ 'failed_at IS NULL and run_at <= ?', Time.now.utc ] - ).count + ) end elsif defined?(Mongoid) and backend?(/Mongoid/) Delayed::Job.where(