sidekiq-failures icon indicating copy to clipboard operation
sidekiq-failures copied to clipboard

Sidekiq 7 boot troubles with failures_max_count unavailable.

Open knightq opened this issue 2 years ago • 3 comments
trafficstars

This gem doesn't seem to work with sidekiq 7.

If you have set the failures_max_count options on an initializer:

Sidekiq.configure_server do |config|
  config.failures_max_count = 5000
end

after upgrading to Sidekiq 7 on boot you get:

undefined method `failures_max_count=' for #<Sidekiq::Config:0x000056331ecfefe8>
api-sidekiq_1            | /app/config/initializers/sidekiq.rb:5:in `block in <main>'
api-sidekiq_1            | /bundle/ruby/2.7.0/gems/sidekiq-7.0.2/lib/sidekiq.rb:98:in `configure_server'
api-sidekiq_1            | /app/config/initializers/sidekiq.rb:3:in `<main>'

knightq avatar Dec 16 '22 11:12 knightq

Hello @knightq

This is related to the following change in the config strategy of sidekiq 7: https://github.com/mperham/sidekiq/blob/main/docs/capsule.md#sidekiqconfig

If you set the config options of the sidekiq-failures gem outside sidekiq's configure_server block no exception is raised and the gem works as expected.

Instead of:

Sidekiq.configure_server do |config|
  config.failures_max_count = 5000
end

You can do this:

Sidekiq.failures_max_count = 5000

Sidekiq.configure_server do |config|
  # Other sidekiq config
end

severinkaelin avatar Dec 23 '22 17:12 severinkaelin

This also fixed it for me. Thank you.

scarroll32 avatar Feb 01 '23 07:02 scarroll32

This fixed it for me too, thank you

chrishough avatar Apr 08 '23 19:04 chrishough