Skip to content

Commit

Permalink
Merge 97bd826 into 2a3d237
Browse files Browse the repository at this point in the history
  • Loading branch information
aushm committed Sep 6, 2023
2 parents 2a3d237 + 97bd826 commit 6dea5d7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
strategy:
matrix:
ruby-version: ['3.1', '2.7']
sidekiq-version: ['4', '5', '6.0', '6.1', '6.x']
sidekiq-version: ['4', '5', '6.0', '6.1', '6.x', '7.x']

steps:
- uses: actions/checkout@v3

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}

Expand Down
5 changes: 5 additions & 0 deletions gemfiles/sidekiq_7.x.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem 'sidekiq', '~> 7.0.0'

gemspec path: '../'
2 changes: 2 additions & 0 deletions lib/sidekiq-rate-limiter/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
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)
elsif (Sidekiq::VERSION >= '7.0')
config[:fetch_class] = Sidekiq::RateLimiter::Fetch
else
Sidekiq[:fetch] = Sidekiq::RateLimiter::Fetch.new(Sidekiq)
end
Expand Down
2 changes: 1 addition & 1 deletion sidekiq-rate-limiter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "simplecov"
s.add_development_dependency "simplecov-lcov", '~> 0.8.0'

s.add_dependency "sidekiq", ">= 4.0", "< 7.0"
s.add_dependency "sidekiq", ">= 4.0", "< 8.0"
s.add_dependency "redis_rate_limiter"
end
11 changes: 10 additions & 1 deletion spec/sidekiq-rate-limiter/fetch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def perform(arg1, arg2); end
let(:options) do
if Sidekiq::VERSION =~ /^(4|5|6\.[0-4])/
{ queues: [queue, another_queue, another_queue] }
elsif Sidekiq::VERSION.start_with?('7.')
config = Sidekiq.default_configuration
config.queues = [queue, another_queue, another_queue]
config.default_capsule
else
Sidekiq.tap { |s| s[:queues] = [queue, another_queue, another_queue] }
end
Expand Down Expand Up @@ -59,7 +63,12 @@ def perform(arg1, arg2); end
timeout = _timeout
end

fetch = described_class.new options.merge!(:strict => true)
if !Sidekiq::VERSION.start_with?('7.')
options.merge!(strict: true)
end

fetch = described_class.new(options)

expect(fetch.queues_cmd).to eql(["queue:#{queue}", "queue:#{another_queue}", timeout])
end

Expand Down

0 comments on commit 6dea5d7

Please sign in to comment.