Sha256: fd045296ea71e06c5fc0a99c1755e4f0ef139acb49d534427913658002304d2d

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

require "sidekiq"
require "sidekiq/fetch"

require_relative "./throttled_retriever"

module Sidekiq
  module Throttled
    module Patches
      module BasicFetch
        def self.prepended(base)
          base.prepend(ThrottledRetriever)
        end

        private

        # Returns list of queues to try to fetch jobs from.
        #
        # @note It may return an empty array.
        # @param [Array<String>] queues
        # @return [Array<String>]
        def queues_cmd
          throttled_queues = Throttled.cooldown&.queues
          return super if throttled_queues.nil? || throttled_queues.empty?

          super - throttled_queues
        end
      end
    end
  end
end

Sidekiq::BasicFetch.prepend(Sidekiq::Throttled::Patches::BasicFetch)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-throttled-1.5.2 lib/sidekiq/throttled/patches/basic_fetch.rb
sidekiq-throttled-1.5.1 lib/sidekiq/throttled/patches/basic_fetch.rb
sidekiq-throttled-1.5.0 lib/sidekiq/throttled/patches/basic_fetch.rb