Skip to content
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

allow mail rendering at delay time #672

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hqm42
Copy link

@hqm42 hqm42 commented Jun 19, 2014

The current solution to delayed mail delivery renders the mail template at delivery time:

Notifier.delay.signup(@user)

This can lead to problems, if your data that is accessed by the mail template changed between delay time and delivery time.

When you try to explicitly delay delivery forcing rendering you will get an error:

Notifier.signup(@user).delay.deliver
# Use MyMailer.delay.mailer_action(args) to delay sending of emails.

The new approach will serialize the mail message at delay time using Mail::Message.encoded and deserialize using the constructor:

Notifier.signup(@user).delay.deliver
# works like expected (render message -> delay -> execute job -> deliver)

The old approach:

Notifier.delay.signup(@user)
# still works (delay -> execute job -> render message -> deliver)

The current solution to delayed mail delivery renders the mail template at delivery time:
    Notifier.delay.signup(@user)

When you try to explicitly delay delivery you will get an error:
    Notifier.signup(@user).delay.deliver
    > Use MyMailer.delay.mailer_action(args) to delay sending of emails.

The new approach will serialize the mail message at delay time using Mail::Message.encoded and deserialize using the constructor:
    Notifier.signup(@user).delay.deliver
@sferik sferik force-pushed the master branch 2 times, most recently from 00c7e65 to 27ce6b0 Compare October 8, 2014 16:38
@wgc-as
Copy link

wgc-as commented Dec 8, 2014

+1 When will this be merged in?

@albus522
Copy link
Member

albus522 commented Apr 2, 2015

My primary concern with this is that it seriously increases the risk of a silent serialization errors due to exceeding the handler size. We get a lot of confusion when databases like Mysql simply truncate the data and move one. Unfortunately I can't find the conversation about why this is a difficult problem, but the short version is that text fields are reported as unlimited length but they aren't actually unlimited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants