在 Rails 应用程序中,电子邮件应该作为后台作业发送还是同步发送?

发布于 2024-08-24 17:29:37 字数 172 浏览 6 评论 0原文

我们即将发布新的 Rails 应用程序,到目前为止,人们的兴趣似乎非常浓厚,我们有点担心瓶颈会在哪里。其中之一似乎是注册时和其他情况下的系统电子邮件。这是正确的吗?

是否应该在后台异步发送给用户的单独电子邮件?如果是这样,最好的解决方案是什么?

我查看了一些解决方案,似乎找不到任何明确的解决方案。

We are getting close to releasing our new rails app and so far interest seems very strong we are a little worried about where bottle necks will be. One seems to be system e-mails on signup and in other situations. Is this correct?

Should individual e-mails to users be sent asynchronously in the background? If so, what would be the best solution?

I have looked at a few solutions and can't seem to find anything definitive.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

疏忽 2024-08-31 17:29:37

我想说这取决于你的要求。如果您需要能够通知用户发送邮件失败,请在同一线程中执行此操作。

如果没有,发送邮件应该支持重试等,所以我会将消息放入队列/文件系统/数据库表/等中,并让另一个线程/进程处理发送的细节。

I would say it depends on your requirements. If you need to be able to inform the user that sending mail failed, do it in the same thread.

If not, sending mail should support things like retries etc, so I would put the message into a queue/the filesystem/database table/etc and have another thread/process deal with the details of sending.

寂寞清仓 2024-08-31 17:29:37

同样的线程,如果你问我......通过在电子邮件服务器拾取的放置文件夹中生成一个文件。那么就没有太多的开销,所以单独的线程没有什么意义。

至少我总是这样处理这个问题。

Same thread, if you ask me.... by generating a file in a drop folder, which an email server picks up. Then there is not too much overhead, so a seaprate threads makes little sense.

At least this is how I always handle this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文