Fix rate limit check for register. Fixes #2159

This commit is contained in:
Dessalines 2022-03-24 16:13:58 -04:00
parent dfb0938738
commit ed9f70276d

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
} }
} }