Module: SidekiqPublisher::Compatibility

Defined in:
lib/sidekiq_publisher/compatibility.rb

Class Method Summary collapse

Class Method Details

.sidekiq_job_classObject

Sidekiq::Worker will be renamed to Sidekiq::Job in sidekiq 7.0.0 and a deprecation warning will be printed in sidekiq 6.4.0, per mperham/sidekiq#4971. Sidekiq 6.2.2 (mperham/sidekiq@8e36432) introduces an alias and 6.3.0 includes it when the gem is loaded. This alias is used here to ensure future compatibility.



11
12
13
14
15
16
17
18
19
# File 'lib/sidekiq_publisher/compatibility.rb', line 11

def sidekiq_job_class
  @_sidekiq_job_class ||= Gem::Dependency.new("sidekiq", ">= 6.3.0").then do |dependency|
    if dependency.match?(Gem.loaded_specs["sidekiq"])
      Sidekiq::Job
    else
      Sidekiq::Worker
    end
  end
end