Sha256: 099fde8a8380c8894af4d33fe0a37fcfbfdb7efe9b3e9ccfffc7fffa1d237eb7

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 Bytes

Contents

require 'delayed_job'
module LogStasher
  module Delayed
    class Plugin < ::Delayed::Plugin
      callbacks do |lifecycle|
        lifecycle.before(:invoke_job) do |job, *args, &block|
          ::LogStasher.request_context[:request_id] = job.id
          # perhaps handler#object.first_line and method_name would be interesting too (in store??)
        end
        lifecycle.after(:invoke_job) do |job, *args, &block|
          ::LogStasher.request_context[:request_id] = nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstasher-0.8.2 lib/logstasher/delayed/plugin.rb
logstasher-0.8.0 lib/logstasher/delayed/plugin.rb