Sha256: dda4d5b0e78562e8c51f10784b5a639878998246f2c2cc683a679421a19606ff

Contents?: true

Size: 633 Bytes

Versions: 16

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

module Kiev
  module Sidekiq
    class StoreRequestDetails
      JID = "jid"
      WRAPPED = "wrapped"

      def call(worker, job, _queue)
        Config.instance.jobs_propagated_fields.each do |key|
          Kiev[key] = job[key.to_s]
        end
        request_store = Kiev::RequestStore.store
        request_store[:background_job] = true
        request_store[:job_name] = expand_worker_name(worker, job)
        request_store[:jid] = job[JID]
        yield
      end

      private

      def expand_worker_name(worker, job)
        job[WRAPPED] || worker.class.name
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kiev-4.9.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.8.3 lib/kiev/sidekiq/store_request_details.rb
kiev-4.8.2 lib/kiev/sidekiq/store_request_details.rb
kiev-4.8.1 lib/kiev/sidekiq/store_request_details.rb
kiev-4.8.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.7.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.6.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.5.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.4.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.3.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.2.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.1.0 lib/kiev/sidekiq/store_request_details.rb
kiev-4.0.0 lib/kiev/sidekiq/store_request_details.rb
kiev-3.0.0 lib/kiev/sidekiq/store_request_details.rb
kiev-2.8.0 lib/kiev/sidekiq/store_request_details.rb
kiev-2.7.3 lib/kiev/sidekiq/store_request_details.rb