Module: JobTick::Hooks::ActiveJob

Defined in:
lib/jobtick/hooks/active_job.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/jobtick/hooks/active_job.rb', line 6

def self.included(base)
  base.around_perform do |job, block|
    key = JobTick.monitor_key_for(job.class.name)
    if key
      JobTick::Monitor.run(key) { block.call }
    else
      block.call
    end
  end
end