Rails - Devise lag when sending welcome email
I send a welcome email to a user after he was create using the following code in my model:
after_create :send_welcome_email
...
def send_welcome_email
EmailerUtilizator.welcome_email(self).deliver
end
开发者_StackOverflow社区I do this with an ajax call, the delived method has a short but noticeable delay. Shall I use an async method ? Or shall I use some sort of waiting animation ?
Thank you,
Perhaps combine with delayed_job? If they receive an email in 2-3 minutes even it's acceptable and also consider the scenario of concurrent registrations!
def send_welcome_email
EmailerUtilizator.delay.welcome_email(self)
end
精彩评论