From c89295ef7e8eeff2ed727695755a3b31c61b992e Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 6 Sep 2022 20:33:25 +0000 Subject: [PATCH] we should use retry_at --- web3_proxy/src/frontend/rate_limit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web3_proxy/src/frontend/rate_limit.rs b/web3_proxy/src/frontend/rate_limit.rs index 50d09c7e..0630a948 100644 --- a/web3_proxy/src/frontend/rate_limit.rs +++ b/web3_proxy/src/frontend/rate_limit.rs @@ -237,6 +237,7 @@ impl Web3ProxyApp { if let Some(rate_limiter) = &self.rate_limiter { // TODO: query redis in the background so that users don't have to wait on this network request // TODO: better key? have a prefix so its easy to delete all of these + // TODO: we should probably hash this or something let rate_limiter_label = user_key.to_string(); match rate_limiter @@ -248,8 +249,8 @@ impl Web3ProxyApp { .await { Ok(ThrottleResult::Allowed) => {} - Ok(ThrottleResult::RetryAt(_retry_at)) => { - // TODO: set headers so they know when they can retry + Ok(ThrottleResult::RetryAt(retry_at)) => { + // TODO: set headers so they know when they can retry or maybe tarpit them? if they are barely over? debug!(?rate_limiter_label, "user rate limit exceeded"); // this is too verbose, but a stat might be good // TODO: use their id if possible return Ok(RateLimitResult::UserRateLimitExceeded(user_data.user_id));