Skip to content

Commit

Permalink
Reduce rate limit to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoniosBarotsis committed Jun 8, 2024
1 parent 59c9d18 commit 92fba33
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ and this project adheres to
### Added

- `DomainChanges.tls`
- Rate limiting (default 10/s), configurable with `RATE_LIMIT` env variable (async only)
- Rate limiting (default 9/s), configurable with `RATE_LIMIT` env variable (async only)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Crate documentation is available in [docsrs][docs-url]. Example usage is availab
- `RESEND_BASE_URL` to override the default base address:
`https://api.resend.com` (Optional).
- `RATE_LIMIT` to set the maximum amount of requests you can send per second. By default, this is
10 as that is what Resend defaults to. In reality, the time window is set to 1.1s to avoid
9 (Resend defaults to 10). In reality, the time window is set to 1.1s to avoid
failures. This is thread-safe (as long as you use the same `Resend` client across threads!)

> <div class="warning">WARNING: Rate limiting only works when using the async version (default) of the crate</div>
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Config {
// ==== Rate limiting is a non-blocking thing only ====
#[cfg(not(feature = "blocking"))]
let rate_limit_per_sec = env::var("RATE_LIMIT")
.unwrap_or_else(|_| "10".to_owned())
.unwrap_or_else(|_| "9".to_owned())
.parse::<u32>()
.expect("env variable `RATE_LIMIT` should be a valid u32");

Expand Down

0 comments on commit 92fba33

Please sign in to comment.