• Sean McGivern's avatar
    Set default retries for mailers to 3 · d1b9c810
    Sean McGivern authored
    We changed the default retries for Sidekiq jobs from 3 to the upstream
    default of 25. When we did this, we manually set all existing workers to
    have 3 retries, to avoid changing existing behaviour.
    
    However, mailer jobs aren't run through a worker we define: they go via
    ActiveJob. This isn't a huge deal, but typically if a mailer fails
    twice, it will fail forever. Also, 25 retries take a few weeks: it's not
    very useful to get an email several weeks after it was scheduled to
    send.
    
    In Sidekiq 6, ActiveJob will have the ability to use `sidekiq_options`,
    but in Sidekiq 5 we'll just get this error:
    
        You cannot include Sidekiq::Worker in an ActiveJob
    
    Instead, here we manually replace the `#enqueue` and `#enqueue_at`
    methods for the Sidekiq adapter to ActiveJob, and special-case those to
    give 3 retries for mailer jobs again.
    
    Changelog: fixed
    d1b9c810
mailer_retries.rb 1.05 KB