From 514c1ab298d858b24d30af67578251db19bbc5d8 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 fc838c1f..bf3249e1 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 {