Sha256: efb7f0b5936be1bf7e8b448b0e192d31182a31e8029240ce5eb2ff8838cad330

Contents?: true

Size: 548 Bytes

Versions: 16

Compression:

Stored size: 548 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)
            data = job.merge(Labkit::Context.log_key(:caller_id) => job["class"])

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gitlab-labkit-0.16.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.16.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.15.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.14.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.5 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.4 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.3 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.2 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.13.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.12.2 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.12.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.12.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.11.0 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.10.1 lib/labkit/middleware/sidekiq/context/server.rb
gitlab-labkit-0.10.0 lib/labkit/middleware/sidekiq/context/server.rb