-
Notifications
You must be signed in to change notification settings - Fork 22k
Do not inline process mailers when calling deliver_all_later #55659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,16 @@ class DummyJob < ActionMailer::MailDeliveryJob; end | |
end | ||
end | ||
|
||
test "deliver_all_later does not inline process the mailers" do | ||
mail1 = DelayedMailer.test_message(1) | ||
mail2 = DelayedMailer.test_message(2) | ||
|
||
ActionMailer.deliver_all_later(mail1, mail2) | ||
|
||
assert_not mail1.processed? | ||
assert_not mail2.processed? | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for merging @fatkodima . But sorry if you don't mind i'm going to add back at least the test where we pass an array to properly test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
test "deliver_all_later enqueues multiple deliveries with correct jobs" do | ||
old_delivery_job = BaseMailer.delivery_job | ||
BaseMailer.delivery_job = DummyJob | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after some research, i think what happens is the following:
flatten!
tries to callrespond_to?
on each elementrespond_to?
gets delegated to__getobj__
@mail_message ||= processed_mailer.message
processed_mailer
triggers the inline processing of the mailerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct,
flatten!
callsArray()
which callsrespond_to?(:to_ary)
and so on