Heroku:多次推迟发送电子邮件的工作 [英] Heroku: delayed job sending email multiple times

查看:155
本文介绍了Heroku:多次推迟发送电子邮件的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku中部署了一个应用程序(Rails 3)。
为了向近500位用户发送电子邮件摘要,我们使用的是delayed_job。

  Notifier.delay.send_email_digest(digest_content ,@user)

我的应用程序有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:多次推迟发送电子邮件的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆