From ed9f70276daa8831d90b2603135ccf323c86252e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 24 Mar 2022 16:13:58 -0400 Subject: [PATCH] Fix rate limit check for register. Fixes #2159 --- crates/utils/src/rate_limit/mod.rs | 32 ++---------------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index d56dc0c5..55a1ae8a 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -98,7 +98,7 @@ impl RateLimited { &ip_addr, rate_limit.post, rate_limit.post_per_second, - true, + false, )?; } RateLimitType::Register => { @@ -107,7 +107,7 @@ impl RateLimited { &ip_addr, rate_limit.register, rate_limit.register_per_second, - true, + false, )?; } RateLimitType::Image => { @@ -133,34 +133,6 @@ impl RateLimited { let res = fut.await; - // after - { - let mut limiter = self.rate_limiter.lock().await; - if res.is_ok() { - match self.type_ { - RateLimitType::Post => { - limiter.check_rate_limit_full( - self.type_, - &ip_addr, - rate_limit.post, - rate_limit.post_per_second, - false, - )?; - } - RateLimitType::Register => { - limiter.check_rate_limit_full( - self.type_, - &ip_addr, - rate_limit.register, - rate_limit.register_per_second, - false, - )?; - } - _ => (), - }; - } - } - res } } -- 2.44.1