Module: Caffeinate::DeliverAsync

Defined in:
lib/caffeinate/deliver_async.rb

Overview

Method for handling async delivery. ‘include` it for plug-and-play.

class MyWorker
  include Sidekiq::Worker
  include Caffeinate::AsyncMailing
end

To use this, make sure your initializer is configured correctly:

config.async_delivery = true
config.async_delivery_class = 'MyWorker'

Instance Method Summary collapse

Instance Method Details

#perform(mailing_id) ⇒ Object



15
16
17
18
19
20
# File 'lib/caffeinate/deliver_async.rb', line 15

def perform(mailing_id)
  mailing = ::Caffeinate::Mailing.find(mailing_id)
  return unless mailing.pending?

  mailing.deliver!
end