Fix case where email method short-circuits and returns nil

This commit is contained in:
Mike Perham 2012-10-19 10:50:44 -07:00
parent e793ea9a6d
commit 4d3c05db49
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
HEAD
-----------
- ActionMailer.delay.method now only tries to deliver if method returns a valid message.
- Logging now uses "MSG-#{Job ID}", not a random msg ID
- Allow generic Redis provider as environment variable. [#443]
- Add ability to customize sidekiq\_options with delay calls [#450]

View File

@ -16,7 +16,10 @@ module Sidekiq
def perform(yml)
(target, method_name, args) = YAML.load(yml)
target.send(method_name, *args).deliver
msg = target.send(method_name, *args)
# The email method can return nil, which causes ActionMailer to return
# an undeliverable empty message.
msg.deliver if msg && msg.to && msg.from
end
end