From: Dessalines Date: Fri, 7 Feb 2020 03:48:43 +0000 (-0500) Subject: Fixing rate limiting. X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%24%7B%60data:application/%22https:/hacktivis.me/README.zh.hant.md?a=commitdiff_plain;h=218653c52f1998725eaa1e68ce6689b5c92b492a;p=lemmy.git Fixing rate limiting. --- 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 {