Skip to content

Commit

Permalink
Update lib/dj_mon/backend/activerecord.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
maletor committed Sep 10, 2012
1 parent ab195d2 commit 35ebc77
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/dj_mon/backend/activerecord.rb
Expand Up @@ -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
Expand Down

0 comments on commit 35ebc77

Please sign in to comment.