Class: Djwatchman::DelayedJobMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/djwatchman.rb

Class Method Summary collapse

Class Method Details

.runObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/djwatchman.rb', line 5

def self.run
  begin
    count = Delayed::Job.where("created_at < ?", (ENV['DJWATCHMAN_MINUTES'] || 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