Class: RorVsWild::Plugin::Faktory

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/plugin/faktory.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setupObject


4
5
6
7
8
9
10
# File 'lib/rorvswild/plugin/faktory.rb', line 4

def self.setup
  if defined?(::Faktory)
    ::Faktory.configure_worker do |config|
      config.worker_middleware { |chain| chain.add(Faktory) }
    end
  end
end

Instance Method Details

#call(worker_instance, job, &block) ⇒ Object


12
13
14
15
16
# File 'lib/rorvswild/plugin/faktory.rb', line 12

def call(worker_instance, job, &block)
  custom = job["custom".freeze]
  name = (custom && custom["wrapped".freeze]) || job["jobtype".freeze]
  RorVsWild.agent.measure_job(name, parameters: job["args".freeze], &block)
end