Disable automatic retry with ActiveJob, used with Sidekiq

后端 未结 6 1010
名媛妹妹
名媛妹妹 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:20

    As of sidekiq 6.0.1, it is possible to pass the following to an ActiveJob worker to prevent it from retrying:

    class ExampleJob < ActiveJob::Base
      sidekiq_options retry: false
    
      def perform(*args)
        # Perform Job
      end
    end
    

    More information: https://github.com/mperham/sidekiq/wiki/Active-Job#customizing-error-handling

    EDIT:

    According to this this requires Rails 6.0.1 or later as well.

提交回复
热议问题