Module: SidekiqSolidFetch::Throttled
- Defined in:
- lib/sidekiq_solid_fetch/throttled.rb
Overview
Opt-in integration with sidekiq-throttled (>= 2.0).
sidekiq-throttled's stock requeue path treats any non-SuperFetch fetcher like BasicFetch: it LPUSHes a copy of the throttled job back to the queue without removing the original from the processing queue. With this fetcher that leaks one duplicate per throttle cycle, which bulk_requeue or orphan recovery would later re-inject as real jobs.
setup! prepends sidekiq-throttled's fetch patches to the Fetcher and
teaches Strategy#re_enqueue_throttled to atomically MOVE our UnitOfWork
back to the target queue instead of copying it.
require "sidekiq_solid_fetch/throttled"
Sidekiq.configure_server do |config|
SidekiqSolidFetch.enable!(config)
SidekiqSolidFetch::Throttled.setup!
end
Defined Under Namespace
Modules: StrategyPatch
Constant Summary collapse
- MINIMUM_VERSION =
"2.0.0"
Class Method Summary collapse
Class Method Details
.setup! ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/sidekiq_solid_fetch/throttled.rb', line 34 def self.setup! unless Gem::Version.new(Sidekiq::Throttled::VERSION) >= Gem::Version.new(MINIMUM_VERSION) raise "SidekiqSolidFetch::Throttled requires sidekiq-throttled >= #{MINIMUM_VERSION} " \ "(found #{Sidekiq::Throttled::VERSION})" end SidekiqSolidFetch::Fetcher.prepend(Sidekiq::Throttled::Patches::BasicFetch) Sidekiq::Throttled::Strategy.prepend(StrategyPatch) end |