Sha256: 6513953167d259fbc8d579af2deac932d573d95453926e1e0e6c19b4c0107e3f

Contents?: true

Size: 620 Bytes

Versions: 9

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

module Labkit
  module Middleware
    module Sidekiq
      module Context
        # This middleware for Sidekiq-client uses the values stored on a job to
        # reinstantiate a context in which the job will run.
        class Server
          def call(_worker_class, job, _queue)
            worker_name = (job["wrapped"].presence || job["class"]).to_s
            data = job.merge(Labkit::Context.log_key(:caller_id) => worker_name)

            Labkit::Context.with_context(data) do |_context|
              yield
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab-labkit-0.21.3 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.21.2 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.21.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.21.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.20.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.19.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.18.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.17.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.16.2 lib/labkit/middleware/sidekiq/context/server.rb