class Sidekiq::DynamicThrottle::Fetch

Public Instance Methods

retrieve_work() click to toggle source
# File lib/sidekiq-dynamic-throttle/fetch.rb, line 3
def retrieve_work
  work = Sidekiq.redis { |conn| conn.brpop(*unthrottled_queues) }
  UnitOfWork.new(*work) if work
end

Private Instance Methods

unthrottled_queues() click to toggle source
# File lib/sidekiq-dynamic-throttle/fetch.rb, line 10
def unthrottled_queues
  queues_cmd.reject do |queue|
    throttles = Sidekiq::DynamicThrottle.throttles[queue]
    next if throttles.blank?

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