Skip to content

Commit

Permalink
Add support for new Sidekiq's configuration model introduced in sidek…
Browse files Browse the repository at this point in the history
  • Loading branch information
anero committed Jul 28, 2022
1 parent 3e8bc81 commit 150a5b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/sidekiq-rate-limiter/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
require 'sidekiq-rate-limiter/fetch'

Sidekiq.configure_server do |config|
Sidekiq.options[:fetch] = Sidekiq::RateLimiter::Fetch
# Backwards compatibility for Sidekiq < 6.1.0 (see https://github.com/mperham/sidekiq/pull/4602 for details)
if (Sidekiq::BasicFetch.respond_to?(:bulk_requeue))
Sidekiq.options[:fetch] = Sidekiq::RateLimiter::Fetch
elsif (Sidekiq::VERSION < '6.5.0') # Sidekiq config was redesigned in https://github.com/mperham/sidekiq/pull/5340
Sidekiq.options[:fetch] = Sidekiq::RateLimiter::Fetch.new(Sidekiq.options)
else
Sidekiq[:fetch] = Sidekiq::RateLimiter::Fetch.new(Sidekiq)
end
end

0 comments on commit 150a5b8

Please sign in to comment.