1
0
Fork 0
mirror of https://github.com/deanpcmad/sidekiq-limit_fetch.git synced 2022-11-09 13:54:36 -05:00

Fix compatibility issue for sidekiq v6.1.0+

Since v6.1.0 Sidekiq::BasicFetcher doesn't support class-level method
bulk_requeue. See https://github.com/mperham/sidekiq/pull/4602 for details.

For backwards compatibility we should support both interfaces
depending on class method presence.
This commit is contained in:
Andrew Kozin (nepalez) 2021-03-10 17:15:37 +03:00
parent 1207ba94d1
commit 96f2bec8d6

View file

@ -26,8 +26,14 @@ module Sidekiq::LimitFetch
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