Module: Sidekiq::Throttled::Patches::BasicFetch

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

Instance Method Summary collapse

Instance Method Details

#retrieve_workSidekiq::Throttled::UnitOfWork?

Retrieves job from redis.

Returns:

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


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sidekiq/throttled/patches/basic_fetch.rb', line 13

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