Is there a way to disable automatic retry with ActiveJob and Sidekiq ?
I know that with Sidekiq only, we just have to put
sidekiq_options :retry => f
If you want to disable retry (or add any other Sidekiq options) for ActiveJob
from gems (like for ActionMailbox::RoutingJob
), you can use this approach (Rails 6.0.2+).
1) Create a module with the desired Sidekiq options (using ActiveSupport::Concern
)
# lib/fixes/action_mailbox_routing_job_sidekiq_fix.rb
module ActionMailboxRoutingJobSidekiqFix
extend ActiveSupport::Concern
included do
sidekiq_options retry: false
end
end
2) Include it in the job class in an initializer.
# config/initializers/extensions.rb
require Rails.root.join('lib', 'fixes', 'action_mailbox_routing_job_sidekiq_fix')
Rails.configuration.to_prepare do
ActionMailbox::RoutingJob.include ::ActionMailboxRoutingJobSidekiqFix
end