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

Rate Limiting/Retry mechanism for short-term errors #1

Closed
ben-z opened this issue Nov 29, 2023 · 3 comments
Closed

Rate Limiting/Retry mechanism for short-term errors #1

ben-z opened this issue Nov 29, 2023 · 3 comments

Comments

@ben-z
Copy link
Member

ben-z commented Nov 29, 2023

SMTP providers usually have (short-term) rate limits (e.g. can't send more than 20 emails per second). Add an option to support this. The GitHub provider achieves this by using a custom centralized transport.

@ben-z
Copy link
Member Author

ben-z commented Nov 29, 2023

Can simply use a mutex, a last-sent timestamp, and a sleep to achieve this. The parameter can be the minimum time between requests.

@ben-z
Copy link
Member Author

ben-z commented May 2, 2024

Alternatively we can implement error handling for errors like 421. This happens when I try to send 20 emails at once using a gmail SMTP server:

╷
│ Error: 421 4.3.0 Temporary System Problem. Try again later (10). For more information,
│ 4.3.0 go to
│ 4.3.0  https://support.google.com/a/answer/3221692 bj19-20020a05620a191300b00790afc26983sm61858qkb.72 - gsmtp
│
│   with email_email.all_emails["REDACTED"],
│   on main.tf line 49, in resource "email_email" "all_emails":
│   49: resource "email_email" "all_emails" {
│

https://chat.openai.com/share/96fe4067-6bc9-4696-add3-e8788e07aea3

All 4xx SMTP errors are retriable:
https://apps.google.com/supportwidget/articlehome?article_url=https://support.google.com/a/answer/3221692&assistant_id=generic-unu&product_context=3221692&product_name=UnuFlow&trigger_context=a

@ben-z ben-z changed the title Rate Limiting Rate Limiting/Retry mechanism for short-term errors May 2, 2024
@ben-z
Copy link
Member Author

ben-z commented May 30, 2024

Solved by #2 (comment)

@ben-z ben-z closed this as completed May 30, 2024
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