Heroku:多次推迟发送电子邮件的工作

编程入门 行业动态 更新时间:2024-10-27 02:21:59
本文介绍了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:多次推迟发送电子邮件的工作

本文发布于:2023-11-25 12:35:29,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发送电子邮件   工作   Heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!