Skip to content

Too, too many objects #23

Closed
wants to merge 2 commits into from
View
12 lib/dj_mon/backend/activerecord.rb
@@ -3,29 +3,29 @@ module Backend
module ActiveRecord
class << self
def all
- Delayed::Job.all
+ Delayed::Job.last(500)
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
Something went wrong with that request. Please try again.