Skip to content

Commit

Permalink
disallow burstiness in rate limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Oct 15, 2023
1 parent a247da8 commit 5ac99d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/cli/src/parse/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pub(crate) async fn parse_source(args: &Args) -> Result<Source, ParseError> {
let chain_id = provider.get_chainid().await.map_err(ParseError::ProviderError)?.as_u64();

let rate_limiter = match args.requests_per_second {
Some(rate_limit) => match NonZeroU32::new(rate_limit) {
Some(value) => {
let quota = Quota::per_second(value);
Some(rate_limit) => match (NonZeroU32::new(1), NonZeroU32::new(rate_limit)) {
(Some(one), Some(value)) => {
let quota = Quota::per_second(value).allow_burst(one);
Some(RateLimiter::direct(quota))
}
_ => None,
Expand Down

0 comments on commit 5ac99d4

Please sign in to comment.