Sha256: df2cb57c505515fd8c941b891654f13fedc6e855ca5b256dad63bcf60d082bf6

Contents?: true

Size: 560 Bytes

Versions: 4

Compression:

Stored size: 560 Bytes

Contents

require 'faraday'
require 'sidekiq/hierarchy/http'

module Sidekiq
  module Hierarchy
    module Faraday
      class Middleware < ::Faraday::Middleware
        def call(env)
          if Sidekiq::Hierarchy.current_workflow && Sidekiq::Hierarchy.current_jid
            env[:request_headers][Sidekiq::Hierarchy::Http::JID_HEADER] = Sidekiq::Hierarchy.current_jid
            env[:request_headers][Sidekiq::Hierarchy::Http::WORKFLOW_HEADER] = Sidekiq::Hierarchy.current_workflow.jid
          end
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sidekiq-hierarchy-1.1.0 lib/sidekiq/hierarchy/faraday/middleware.rb
sidekiq-hierarchy-1.0.0 lib/sidekiq/hierarchy/faraday/middleware.rb
sidekiq-hierarchy-0.1.4 lib/sidekiq/hierarchy/faraday/middleware.rb
sidekiq-hierarchy-0.1.3 lib/sidekiq/hierarchy/faraday/middleware.rb