开发者

bulk email with GAE and per minute quota

I'm developing a voting application with GAE, which involves sending email to each voter. In my initial tests, I went over the per-minute email quota, and this exception was raised:

OverQuotaError: The API call mail.Send() required more quota than is available.

I was able to solve this short term by enabling billing, which greatly increases the per minute email quota, but what is the right way to prevent such an exception from being raised in the future? If my app becomes wildly successful and I exceed the larger quota, it would be a big problem to have this exception raised.

I don't want to put 开发者_运维知识库the call to send emails in a try, except block, since this is being done after processing a form, and I don't want the user to wait around for the response to the POST.

Is this a good use case for a task queue? If so, would I put a request to send a batch of emails in the task queue or would each request to send an email go in the task queue? The former seems better in that processing the POST would be faster. Regardless of which way I do it, would I add a delay between sending each email to ensure they are not sent to fast and I go over quota?


yes, ideally suited to the task queue as you can limit the rate at which your emails are sent out by changing the properties in the queue.yaml

one email per task would be best, so if the task fails and is retried it will only retry the failed one not all of the batch


yes. use a task queue. if a task is sending a email, you can decide how many tasks should run per minute. and if a task failed it will retry to execute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜