Sha256: 3e9fc6b128bd933aae8dd5f2bc2d37c2fab3699abe020f0e412d1756feeaa41f

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

module Sidekiq
  module Throttled
    module Patches
      module ThrottledRetriever
        # Retrieves job from redis.
        #
        # @return [Sidekiq::BasicFetch::UnitOfWork, nil]
        def retrieve_work
          work = super

          if work && Throttled.throttled?(work.job)
            Throttled.cooldown&.notify_throttled(work.queue)
            Throttled.requeue_throttled(work)
            return nil
          end

          Throttled.cooldown&.notify_admitted(work.queue) if work

          work
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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