Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throttling bug on multiple recipients #59

Open
lVlayhem opened this issue Dec 4, 2013 · 0 comments
Open

Throttling bug on multiple recipients #59

lVlayhem opened this issue Dec 4, 2013 · 0 comments

Comments

@lVlayhem
Copy link

lVlayhem commented Dec 4, 2013

http://sesblog.amazon.com/blog/tag/Throttle

Anyway, regarding what happens when you hit your limits during a call to send to multiple recipients – first remember that normally, sending limits are based on recipients rather than on messages. For example, an email to five recipients counts as five against your daily sending quota. When you send to multiple recipients, though, if you have any emails remaining in your daily sending quota, then your API call (as long as other factors are ok, like none of the addresses are on the blacklist) will go through. Keep in mind however that the amount you have left in your daily sending quota is being continuously calculated by Amazon SES, so it’s not good to be hovering too close to this limit. If you find yourself frequently cutting it this close, submit an Extended Access Request.

It’s a similar story with your send rate quota – if, at the rate you are sending, you have any emails left in your send rate quota, you can send to multiple recipients. However, you will not be able to send further emails until you have built up enough quota again. For example, if your send rate quota is one message per second, and you send a message to five recipients at once, Amazon SES lets you do that. For the next five seconds, though, Amazon will return errors for all send attempts. Once five seconds have passed, you'll have available quota and you will be able to send again. This way, emails with many recipients can get through, and they’ll get through at the overall rate allowed by the quota.

I had this message:

    <Code>Throttling</Code>
    <Message>Maximum sending rate exceeded.</Message>

You need to consider number of recipients for every message.
I can propose this:

n_recipients = len(set(previous_message.recipients()))
additional_delay = 1000 / rate_limit * (n_recipients - 1)

It adds 1/rate_limit seconds for every additional recipient. If there is only one, additional_delay is 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant