Sha256: 5ccc688f9cd33ee8c76acef925a7b004e64a84a3a2af16aa98b285a16ab23985

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

# frozen_string_literal: true

module Labkit
  module Middleware
    module Sidekiq
      # This middleware for Sidekiq-client wraps scheduling jobs in a context
      # The context will also be added to the sidekiq job in redis so it can
      # be reinstantiated by Sidekiq-server when running the job.
      class Client
        def call(_worker_class, job, _queue, _redis_pool)
          Labkit::Context.with_context(caller_id: job["class"]) do |context|
            job.merge!(context.to_h)

            yield
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitlab-labkit-0.9.0 lib/labkit/middleware/sidekiq/client.rb