Skip to content

Commit

Permalink
Use floor instead of round
Browse files Browse the repository at this point in the history
  • Loading branch information
fredriklengstrand committed Mar 28, 2023
1 parent 9600afc commit 721de45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rate.hsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function rate_sliding_window($namespace, $entry, $count, $interval) {
return false;
}

$lastWindow = round(($time - $interval) / $interval);
$lastWindow = floor(($time - $interval) / $interval);
$response = redisClusterCommand("GET", "$namespace:$entry:$lastWindow");
if ($response["error"]) throw Exception($response["error"]);
$lastWindowCount = number($response["reply"]);
Expand Down

0 comments on commit 721de45

Please sign in to comment.