Disable automatic retry with ActiveJob, used with Sidekiq

后端 未结 6 1018
名媛妹妹
名媛妹妹 2021-02-03 23:58

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         


        
6条回答
  •  死守一世寂寞
    2021-02-04 00:47

    Ok thanks for the answer.

    Just for information, I also asked the question in an issue related to this subject on ActiveJob Github repository : https://github.com/rails/activejob/issues/47

    DHH answered me a solution I haven't tested but that can do the job.

    Personnally, I finally put this in an initializer in order to disable Sidekiq retries globally and it works well :

    Sidekiq.configure_server do |config|
       config.server_middleware do |chain|
          chain.add Sidekiq::Middleware::Server::RetryJobs, :max_retries => 0
       end
    end
    

提交回复
热议问题