Ruby version: ruby-2.6.5
Sidekiq: 6.0.5
Rails: 6.0.2.1
We have a class that use sidekiq as ActiveJob adapter in Application.rb:
config.active_job.queue_adapter = :sidekiq
Then configuring the job like that:
require 'sidekiq/api'
class UploadJob < ApplicationJob
sidekiq_options retry: 3
sidekiq_retries_exhausted do |message, error|
...Doing things...
end
def perform(...)
...
When debugging the work, there is a Proc attached to self.sidekiq_retries_exhausted_block, but when arriving to JobRetry::retries_exhausted, then block = worker&.sidekiq_retries_exhausted_block the block is nil, so it doesn't get called.
We use config.death_handlers as a workaround for that, and it's works.
Please include your initializer and any error message with the full backtrace.
Sidekiq.configure_client do |config|
config.redis = RedisConnectionStringParser.parse(connection_string)
end
Sidekiq.configure_server do |config|
config.redis = RedisConnectionStringParser.parse(connection_string)
end
Are you using an old version?
Have you checked the changelogs to see if your issue has been fixed in a later version?
https://github.com/mperham/sidekiq/blob/master/Changes.md
https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md
https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md
ActiveJob does not support sidekiq_retries_exhausted.
In case anyone runs into this in the future, I got around this by just shimming the behavior back in with the death_handlers config:
# app/config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
config.death_handlers << -> (job, exception) do
worker = job["wrapped"].safe_constantize
worker&.sidekiq_retries_exhausted_block&.call(job, exception)
end
end
Most helpful comment
In case anyone runs into this in the future, I got around this by just shimming the behavior back in with the
death_handlersconfig: