Sha256: 31acd888d5c950370499f192822a33a4e23facef05bb6d3722e7f69776adcde0

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 Bytes

Contents

module Sidekiq::DynamicThrottle
  class Fetch < Sidekiq::BasicFetch
    def retrieve_work
      work = Sidekiq.redis { |conn| conn.brpop(*unthrottled_queues) }
      UnitOfWork.new(*work) if work
    end

    private

    def unthrottled_queues
      queues_cmd.reject do |queue|
        throttles = Sidekiq::DynamicThrottle.throttles[queue]
        next if throttles.blank?

        throttles.find { |throttle| throttle.throttled? }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-dynamic-throttle-0.1.2 lib/sidekiq-dynamic-throttle/fetch.rb
sidekiq-dynamic-throttle-0.1.1 lib/sidekiq-dynamic-throttle/fetch.rb
sidekiq-dynamic-throttle-0.1.0 lib/sidekiq-dynamic-throttle/fetch.rb