Fixing rate limiting.

This commit is contained in:
Dessalines 2020-02-06 22:48:43 -05:00
parent bbc7159ede
commit 514c1ab298

View file

@ -318,11 +318,9 @@ impl ChatServer {
}; };
rate_limit.last_checked = current; rate_limit.last_checked = current;
if !check_only { rate_limit.allowance += time_passed * (rate as f64 / per as f64);
rate_limit.allowance += time_passed * (rate as f64 / per as f64); if !check_only && rate_limit.allowance > rate as f64 {
if rate_limit.allowance > rate as f64 { rate_limit.allowance = rate as f64;
rate_limit.allowance = rate as f64;
}
} }
if rate_limit.allowance < 1.0 { if rate_limit.allowance < 1.0 {