Doug
Doug

Reputation: 15515

deliver_later with no retry

How do I disable retries with activeMailer and deliver_later?

I recently ran across an issue where one of my mailer methods was failing silently due to a syntax error in a view. We were using deliver_later to send messages

When it was finally discovered and fixed, all the old messages that had been failing were re-attempted and then delivered. These were time-sensitive messages and should not have been retried.

I can not seem to find any way to do something like .deliver_later(retry: false) Would using deliver_now solve this problem?

I am using delayed_job as my message queue.

Upvotes: 3

Views: 2216

Answers (1)

Cristian Bica
Cristian Bica

Reputation: 4117

ActiveJob does not touch the retry settings of the adapters (https://github.com/rails/rails/blob/master/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb). The only way you can get that if you completely disable the retry mechanism in DJ (Delayed::Worker.max_attempts = 4)

Upvotes: 3

Related Questions