Add MailDeliveryJob for unified mail delivery - #34591
Conversation
eileencodes
left a comment
There was a problem hiding this comment.
I haven't tried this with our app but I think it looks good. One concern I have is the name NewDeliveryJob isn't going to be a good name in a few years so I think we should change it to something we want to keep long term.
And, the NewDeliveryJob class needs to be backported to 5.x to satisfy problem 2. I'll followup with a backport PR if we can all agree on this course of action.
I think if the code isn't deprecated until 6.1 and the jobs work in 6.0 then we don't need a backport.
There was a problem hiding this comment.
I'm not sure NewDeliveryJob is the best name. We don't want users to have to change the constant name back after we fully remove DeliveryJob (and after a few years NewDeliveryJob will be a strange name cause it's not new anymore). What about a name that better describes the roll of this job AND has the new code like MailDeliveryJob?
There was a problem hiding this comment.
My plan was to deprecate NewDeliveryJob and rename to DeliveryJob in 6.2 or 7.0 but that will also cause problems for people that upgrade multiple versions at a time. I'll rename to MailDeliveryJob!
There was a problem hiding this comment.
Sorry missed this on the first round of review - I think params should be nil by default right? Since parameter jobs are a special kind of job?
There was a problem hiding this comment.
Since Parameterized::DeliveryJob isn't released yet can we instead deprecate just DeliveryJob and then recommend the new one? If you need the params key then you should use the new one.
There was a problem hiding this comment.
I removed Parameterized::DeliveryJob from the warning, but the warning will still happen for parameterized delivery jobs because its a subclass. I assume this is good enough?
There was a problem hiding this comment.
I was thinking that Parameterized::DeliveryJob has never been released so we can delete the code that supported Parameterized::DeliveryJob and anyone who needs a Parameterized::DeliveryJob would use the new MailDeliveryJob instead.
There was a problem hiding this comment.
I think it is released in all versions since 5.1.0
There was a problem hiding this comment.
Ah I see I was thinking of this PR 251b9d4 which is only in master.
4f557d3 to
a72684c
Compare
|
Don't we need to add back |
|
Ah, just saw it. |
There was a problem hiding this comment.
This should say MailDeliveryJob now. Also let's add back in the Paramertized deprecation since I was wrong about when it was added.
Add `MailDeliveryJob` for delivering both regular and parameterized mail. Deprecate using `DeliveryJob` and `Parameterized::DeliveryJob`.
a72684c to
f5050d9
Compare
I'm fairly certain that (depending on the number of job workers you have, and your infrastructure) there can be big delays in waiting for all workers to be updated to the latest deployed version of an app. I believe I've seen an old job worker pickup a job enqueued from a new web worker before. Doesn't this mean we should backport |
| require "active_job" | ||
|
|
||
| module ActionMailer | ||
| # The <tt>ActionMailer::NewDeliveryJob</tt> class is used when you |
There was a problem hiding this comment.
It looks like this one mention of NewDeliveryJob stuck around even though most others were updated to MailDeliveryJob instead?
* Update gemfile and run rails app:upgrade * Fix optional belongs to in mail alias * Temp disable bullet * Fix scope deprecation warnings (rails/rails#35186) * Fix mail delivery job deprecation (rails/rails#34591) * Switch to load 6.0 - Fix deprecation warnings about initalizers - Fix model_name eager loading - Fix autoimport - Fix carrierwave * Cleanup * Rubocop * Re-enable bullet * Fix bullet * Update lockfile * Update activity spec and rubocop-performance version * rubocop * Typo * Remove secret token since it is not used since rails 6 * Remove carrierwave uploader * Sentry.rb * Add additional test case for accept mail
|
Hey started, started getting this deprecation warning and I was wondering why... |
Summary
In #34367, we merged a breaking change to
actionmailerthat changed the parameters ofDeliveryJob. This will cause upgrade pains for any app delivering mail in the background. This patch attempts to rectify the situation by reverting and deprecatingDeliveryJobandParameterized::DeliveryJoband introducingNewDeliveryJobto send either kind of mail.Because web and job workers aren't always deployed to in lockstep, and enqueued jobs can be worked off at any time during a deployment, we have two problems to solve:
So, the parameter change to
DeliveryJobneeds to be reverted andParameterized::DeliveryJobneeds to be brought back to satisfy problem 1. And, theNewDeliveryJobclass needs to be backported to 5.x to satisfy problem 2. I'll followup with a backport PR if we can all agree on this course of action.cc @eileencodes @Edouard-chin