Fix rate limit check for register. Fixes #2159

rate_limit_websocket_fail
Dessalines 2022-03-24 16:13:58 -04:00
parent dfb0938738
commit ed9f70276d
1 changed files with 2 additions and 30 deletions

View File

@ -98,7 +98,7 @@ impl RateLimited {
&ip_addr, &ip_addr,
rate_limit.post, rate_limit.post,
rate_limit.post_per_second, rate_limit.post_per_second,
true, false,
)?; )?;
} }
RateLimitType::Register => { RateLimitType::Register => {
@ -107,7 +107,7 @@ impl RateLimited {
&ip_addr, &ip_addr,
rate_limit.register, rate_limit.register,
rate_limit.register_per_second, rate_limit.register_per_second,
true, false,
)?; )?;
} }
RateLimitType::Image => { RateLimitType::Image => {
@ -133,34 +133,6 @@ impl RateLimited {
let res = fut.await; 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 res
} }
} }