lib/honeybadger/plugins/sidekiq.rb in honeybadger-5.2.1 vs lib/honeybadger/plugins/sidekiq.rb in honeybadger-5.3.0
- old
+ new
@@ -22,13 +22,20 @@
end
if defined?(::Sidekiq::VERSION) && ::Sidekiq::VERSION > '3'
::Sidekiq.configure_server do |sidekiq|
- sidekiq.error_handlers << lambda { |ex, sidekiq_params|
+ sidekiq_default_configuration = (::Sidekiq::VERSION > '7') ?
+ ::Sidekiq.default_configuration : Class.new
+
+ sidekiq.error_handlers << lambda { |ex, sidekiq_params, sidekiq_config = sidekiq_default_configuration|
params = sidekiq_params.dup
- if defined?(::Sidekiq::Config) && params[:_config].is_a?(::Sidekiq::Config)
- params[:_config] = params[:_config].instance_variable_get(:@options)
+ if defined?(::Sidekiq::Config)
+ if params[:_config].is_a?(::Sidekiq::Config) # Sidekiq > 6 and < 7.1.5
+ params[:_config] = params[:_config].instance_variable_get(:@options)
+ else # Sidekiq >= 7.1.5
+ params[:_config] = sidekiq_config.instance_variable_get(:@options)
+ end
end
job = params[:job] || params
job_retry = job['retry'.freeze]