class Djwatchman::DelayedJobMonitor

Public Class Methods

run() click to toggle source
# File lib/djwatchman.rb, line 5
def self.run
  begin
    count = Delayed::Job.where("run_at < ?", (ENV['DJWATCHMAN_MINUTES'].to_i || 60).minutes.ago).count
    if count > 0
      raise "There are #{count} unprocessed delayed jobs."
    end
  rescue Exception => e
    puts e.inspect
    puts e.backtrace.inspect
    Airbrake.notify(e, {error_message: "#{e.message}"})
  end
end