Sha256: 29b5676290d10cf39bc64f6cb07981eb60e65967631d9f850d13fae8b4de7e22

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

# internal
require_relative "./registry"

module Sidekiq
  module Throttled
    # Server middleware that notifies strategy that job was finished.
    #
    # @private
    class Middleware
      include Sidekiq::ServerMiddleware if Sidekiq::VERSION >= "6.5.0"

      # Called within Sidekiq job processing
      def call(_worker, msg, _queue)
        yield
      ensure
        Registry.get msg["class"] do |strategy|
          strategy.finalize!(msg["jid"], *msg["args"])
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-throttled-1.0.0.alpha.1 lib/sidekiq/throttled/middleware.rb
sidekiq-throttled-1.0.0.alpha lib/sidekiq/throttled/middleware.rb