Module: LogWeasel::Resque::Callbacks

Defined in:
lib/log_weasel/resque.rb

Class Method Summary collapse

Class Method Details

.after_fork(job, key) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/log_weasel/resque.rb', line 20

def self.after_fork(job, key)
  if job.context && job.context.has_key?('log_weasel_id')
    LogWeasel::Transaction.id = job.context['log_weasel_id']
  else
    LogWeasel::Transaction.create key
  end
end

.before_push(queue, item, key) ⇒ Object



28
29
30
# File 'lib/log_weasel/resque.rb', line 28

def self.before_push(queue, item, key)
  item['context'] = {'log_weasel_id' => (LogWeasel::Transaction.id || LogWeasel::Transaction.create(key))}
end