Skip to content

Commit

Permalink
sidekiq > 7 does not return timeout with queues_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
aushm committed Sep 6, 2023
1 parent 97bd826 commit b983235
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion spec/sidekiq-rate-limiter/fetch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ def perform(arg1, arg2); end
timeout = _timeout
end

expected = [ "queue:#{queue}", "queue:#{another_queue}" ]

if !Sidekiq::VERSION.start_with?('7.')
options.merge!(strict: true)
expected.push(timeout)
end

fetch = described_class.new(options)

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

it 'should retrieve work', queuing: true do
Expand Down
8 changes: 6 additions & 2 deletions spec/sidekiq-rate-limiter/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

it 'should set Sidekiq.options[:fetch] as desired' do
Sidekiq.configure_server do |config|
if Sidekiq::VERSION =~ /^(4|5|6.0)/
if Sidekiq::VERSION =~ /^(4|5|6\.0)/
expect(Sidekiq.options[:fetch]).to eql(Sidekiq::RateLimiter::Fetch)
elsif Sidekiq::VERSION =~ /^7\./
expect(Sidekiq.default_configuration[:fetch_class]).to eq(Sidekiq::RateLimiter::Fetch)
else
expect(Sidekiq.options[:fetch]).to be_a(Sidekiq::RateLimiter::Fetch)
end
Expand All @@ -18,8 +20,10 @@

it 'should inherit from Sidekiq::BasicFetch' do
Sidekiq.configure_server do |config|
if Sidekiq::VERSION =~ /^(4|5|6.0)/
if Sidekiq::VERSION =~ /^(4|5|6\.0)/
expect(Sidekiq.options[:fetch]).to be < Sidekiq::BasicFetch
elsif Sidekiq::VERSION =~ /^7\./
expect(Sidekiq.default_configuration[:fetch_class]).to be < Sidekiq::BasicFetch
else
expect(Sidekiq.options[:fetch].class.ancestors[1]).to be(Sidekiq::BasicFetch)
end
Expand Down

0 comments on commit b983235

Please sign in to comment.