Method: Mailer.with_synched_deliveries

Defined in:
app/models/mailer.rb

.with_synched_deliveriesObject

Execute the given block with inline sending of emails if the default Async queue is used for the mailer. See the Rails guide: Using the asynchronous queue from a Rake task will generally not work because Rake will likely end, causing the in-process thread pool to be deleted, before any/all of the .deliver_later emails are processed



658
659
660
661
662
663
664
# File 'app/models/mailer.rb', line 658

def self.with_synched_deliveries(&)
  adapter = ActionMailer::MailDeliveryJob.queue_adapter
  ActionMailer::MailDeliveryJob.queue_adapter = ActiveJob::QueueAdapters::InlineAdapter.new
  yield
ensure
  ActionMailer::MailDeliveryJob.queue_adapter = adapter
end