From 218653c52f1998725eaa1e68ce6689b5c92b492a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 6 Feb 2020 22:48:43 -0500 Subject: [PATCH] Fixing rate limiting. --- server/src/websocket/server.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/src/websocket/server.rs b/server/src/websocket/server.rs index fc838c1fc..bf3249e1d 100644 --- a/server/src/websocket/server.rs +++ b/server/src/websocket/server.rs @@ -318,11 +318,9 @@ impl ChatServer { }; rate_limit.last_checked = current; - if !check_only { - rate_limit.allowance += time_passed * (rate as f64 / per as f64); - if rate_limit.allowance > rate as f64 { - rate_limit.allowance = rate as f64; - } + rate_limit.allowance += time_passed * (rate as f64 / per as f64); + if !check_only && rate_limit.allowance > rate as f64 { + rate_limit.allowance = rate as f64; } if rate_limit.allowance < 1.0 {