Sha256: e490ad0cd45f2d8bcb350830834dc57c5164c6ddf24c72534bcdb7d0039254a4

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 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 do |context|
            job.merge!(context.to_h)

            yield
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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