[英]aws-ses gem and mass emailing: do I call once with array of 1000 addresses, or loop 1000 times?
I have SES setup and am preparing my app to send out mass emailings of 600 - 1000 addresses per mailing.我已经设置了 SES,并且正在准备我的应用程序以每次邮件发送 600 - 1000 个地址的大量电子邮件。
I would like to know if I should call the send method once with 1000 emails, or call the send 1000 times with one email each.我想知道我是否应该用 1000 封电子邮件调用一次 send 方法,还是用一个 email 调用 send 1000 次。
Also, I'm on Heroku, with a 30 second execution time.另外,我在 Heroku 上,执行时间为 30 秒。
Thanks.谢谢。
You shouldn't be doing anything remotely intensive as sending 1000 emails in a web response.您不应该做任何远程密集的事情,因为在 web 响应中发送 1000 封电子邮件。 I suggest using the Delayed Job gem.
我建议使用延迟作业gem。 It will run the processes in the background by scaling a worker and turning it off when it's done.
它将通过缩放工作人员并在完成后将其关闭来在后台运行进程。 Since workers are charged per minute, you'll have at most a couple cents per month to pay since your task should be done in less than a minute and shouldn't run all that often.
由于工人按分钟收费,因此您每月最多需要支付几美分,因为您的任务应该在不到一分钟的时间内完成,并且不应该经常运行。 You also won't have to worry about the 30 second execution time.
您也不必担心 30 秒的执行时间。
Hope that helps!希望有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.