Skip to content

Commit

Permalink
Fix compatibility issue for sidekiq v6.1.0+
Browse files Browse the repository at this point in the history
Since v6.1.0 Sidekiq::BasicFetcher doesn't support class-level method
bulk_requeue. See sidekiq/sidekiq#4602 for details.

For backwards compatibility we should support both interfaces
depending on class method presence.
  • Loading branch information
nepalez committed Mar 10, 2021
1 parent 1207ba9 commit 96f2bec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/sidekiq/limit_fetch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ def retrieve_work
UnitOfWork.new(queue, job) if job
end

# Backwards compatibility for sidekiq v6.1.0
# @see https://github.com/mperham/sidekiq/pull/4602
def bulk_requeue(*args)
Sidekiq::BasicFetch.bulk_requeue(*args)
if Sidekiq::BasicFetch.respond_to?(:bulk_requeue) # < 6.1.0
Sidekiq::BasicFetch.bulk_requeue(*args)
else # 6.1.0+
Sidekiq::BasicFetch.new(Sidekiq.options).bulk_requeue(*args)
end
end

def redis_retryable
Expand Down

0 comments on commit 96f2bec

Please sign in to comment.