Module: Resque::Plugins::ResqueUUID

Defined in:
lib/resque/plugins/resque_uuid.rb,
lib/resque/plugins/resque_uuid/util.rb,
lib/resque/plugins/resque_uuid/job_extensions.rb,
lib/resque/plugins/resque_uuid/resque_extensions.rb

Defined Under Namespace

Modules: JobExtensions, ResqueExtensions, Util

Class Method Summary collapse

Class Method Details

.enable! ⇒ Object



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

def self.enable!
  Resque.send(:extend, Resque::Plugins::ResqueUUID::ResqueExtensions)
  Resque::Job.send(:include, Resque::Plugins::ResqueUUID::JobExtensions)

  old_after_fork = Resque.after_fork

  Resque.after_fork do |job|
    job.payload_class.uuid = job.uuid if job.payload_class.respond_to?(:uuid=)
    old_after_fork.call(job) if old_after_fork
  end
end