Class: Sidekiq::Extensions::DelayedMailer
- Inherits:
-
Object
- Object
- Sidekiq::Extensions::DelayedMailer
- Includes:
- Worker
- Defined in:
- lib/sidekiq/extensions/action_mailer.rb
Overview
Adds delay, delay_for and delay_until methods to ActionMailer to offload arbitrary email delivery to Sidekiq.
Instance Attribute Summary
Attributes included from Worker
Instance Method Summary collapse
Methods included from Worker
Instance Method Details
#perform(yml) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sidekiq/extensions/action_mailer.rb', line 18 def perform(yml) (target, method_name, args) = YAML.load(yml) msg = target.public_send(method_name, *args) # The email method can return nil, which causes ActionMailer to return # an undeliverable empty message. if msg msg.deliver_now else raise "#{target.name}##{method_name} returned an undeliverable mail object" end end |