我的应用程序有3个Web dynos和2个工作者dynos。 虽然该任务仅在本地发送每个用户的一个电子邮件摘要,但在heroku(制作)中,它向某些用户发送了两个电子邮件摘要(奇怪)。
是否由于两个工人dynos(但为什么?或仅仅是巧合)。 任何人都可以帮我解决问题吗?
谢谢。
解决方案在send_email_digest方法中,您是否调用了交付?延迟作业在发送电子邮件时使用一些魔力,它会自动为您送达。如果你打电话给自己,它会发送多次。我有时会发生这种情况。
We have one application(Rails 3) deployed in Heroku. For sending email digest to nearly about 500 users, we are using delayed_job.
Notifier.delay.send_email_digest(digest_content, @user)My application has 3 web dynos and 2 worker dynos. Though the task is sending only one Email digest per user in local, In heroku (production) it's sending two email digests for some users (strange).
Is it due to two worker dynos (but why?? or mere coincidence). Can anybody help me solve the problem?
Thanks.
解决方案Within your send_email_digest method are you calling deliver? Delayed Job uses some magic when sending emails and it will automatically call deliver for you. If you call deliver yourself it will send multiple times. I've had this happen on occasion.
更多推荐
Heroku:多次推迟发送电子邮件的工作
发布评论