Sha256: 41e0f5acee07484927c87209abd36d4bae08524843fb2f498a247a39f148f918

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 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)
            requeue_throttled(work)
            return nil
          end

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

          work
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-throttled-1.4.0 lib/sidekiq/throttled/patches/throttled_retriever.rb
sidekiq-throttled-1.3.0 lib/sidekiq/throttled/patches/throttled_retriever.rb