Permalink
Browse files

Update lib/dj_mon/backend/activerecord.rb

  • Loading branch information...
1 parent ab195d2 commit 35ebc77ac3c15b2de5799200de9011d7d745d543 @maletor committed Sep 10, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/dj_mon/backend/activerecord.rb
@@ -3,29 +3,29 @@ module Backend
module ActiveRecord
class << self
def all
- Delayed::Job.all
+ Delayed::Job.scoped
end
def failed
- Delayed::Job.where('delayed_jobs.failed_at IS NOT NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NOT NULL').last(500)
end
def active
- Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NOT NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NOT NULL').last(500)
end
def queued
- Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NULL')
+ Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NULL').last(500)
end
def destroy id
dj = Delayed::Job.find(id)
- dj.destroy if dj
+ dj.destroy
end
def retry id
dj = Delayed::Job.find(id)
- dj.update_attributes({ failed_at: nil }) if dj
+ dj.update_attributes({ failed_at: nil })
end
end
end

0 comments on commit 35ebc77

Please sign in to comment.