Module: Sidekiq::Throttled::Patches::ThrottledRetriever

Defined in:
lib/sidekiq/throttled/patches/throttled_retriever.rb

Instance Method Summary collapse

Instance Method Details

#retrieve_workSidekiq::BasicFetch::UnitOfWork?

Retrieves job from redis.

Returns:

  • (Sidekiq::BasicFetch::UnitOfWork, nil)


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sidekiq/throttled/patches/throttled_retriever.rb', line 10

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