验证电子邮件是否应该在后台处理?
是否应该使用某种后台作业(Resque、Delayed_Job 等)在后台处理/发送验证电子邮件?
在发送验证电子邮件之前,该应用程序确实有挂起的倾向。然而,它只挂起一两秒钟。不知道是否值得作为后台任务发送。
你有什么想法?
Should verification emails be processed / sent in the background using some kind of background job (Resque, Delayed_Job, etc)?
The app does have a tendency to hang until a verification email is sent. However, it only hangs for a split second or two. Don't know if its worth sending over as a background task.
What are your thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
需要记住的主要事情是,这种延迟不仅影响当前用户,还会影响其他用户,因为它阻碍了 Rails 进程(其确切影响取决于您正在使用的 Web 服务器和您的服务器)。设置)。
如果此应用程序没有很多用户(将来也不会)并且您目前没有任何后台作业处理,那么可能不值得添加它。否则这可能是个好主意。
The main thing to keep in mind is that this delay isn't affecting just the current user, it's also affecting other users because it's holding up the Rails process (the exact effects of this will depend on the web server you're using and your setup).
If this application doesn't have a lot of users (and won't in the future) and you don't have any background job processing at the moment, then it may not be worth adding it. Otherwise it's probably a good idea.
如果只是几秒钟,那么我认为你可以忍受。但是,如果需要更长的时间,那么您可以将其移至delayed_job,除非您的delayed_job总是堵塞并且您过多地投入后台作业。在这种情况下,将电子邮件发送给用户可能需要更长的时间,并且可能会破坏用户体验。即使在这种情况下,您也可以为发送验证电子邮件设置更高的优先级。
我对delayed_job的能力毫不怀疑,并且已经亲自使用它有一段时间了。甚至 Github 在发布 resque 时也推荐它:
https://github.com/blog/542-introducing-resque
我们需要一个像我们的网络框架一样严肃的后台作业系统。我强烈向网站不包含 50% 后台工作的任何人推荐 DelayedJob。
If it's a few split seconds then I think that you can live with it. But if it takes longer then you may move it to delayed_job unless your delayed_job is always clogged and you are too much into background jobs. In that case it may take a bit longer to send the email to user and may ruin user experience. Even in that case you could set a higher priority for sending the verification emails.
I have no doubts about the capability of delayed_job and have been personally using it for quite some time now. Even Github recommends it while releasing resque:
https://github.com/blog/542-introducing-resque
We need a background job system as serious as our web framework. I highly recommend DelayedJob to anyone whose site is not 50% background work.