开发者

Rails - Devise lag when sending welcome email

开发者 https://www.devze.com 2023-03-15 08:43 出处:网络
I send a welcome email to a user after he was create using the following code in my model: after_create :send_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
0

精彩评论

暂无评论...
验证码 换一张
取 消