Sha256: b119629ff74d33c782b49fcf0045c561f2c6c960bebba130252d19832c33bdaa

Contents?: true

Size: 586 Bytes

Versions: 8

Compression:

Stored size: 586 Bytes

Contents

module Pliny::Sidekiq::Middleware
  module Client
    class RequestId
      def call(worker_class, msg, queue, redis_pool)
        @args = msg['args']
        msg['request_ids'] = request_id.split(',') if request_id
        yield
      end

      private

      attr_reader :args

      def request_id
        @request_id ||=
          request_id_args || Pliny::RequestStore.store[:request_id]
      end

      def request_id_args
        return nil if !args.last.is_a?(Hash)
        options = args.last
        options[:request_id] || options['request_id']
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pliny-sidekiq-0.3.1 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.3.0 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.2.2 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.2.1 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.2.0 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.1.2 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.1.1 lib/pliny/sidekiq/middleware/client/request_id.rb
pliny-sidekiq-0.1.0 lib/pliny/sidekiq/middleware/client/request_id.rb