8000 [RateLimit] Allow to get RateLimit without consuming again. · symfony/symfony@1c94f74 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c94f74

Browse files
committed
[RateLimit] Allow to get RateLimit without consuming again.
1 parent d4c02c8 commit 1c94f74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/RateLimiter/Policy/SlidingWindowLimiter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function reserve(int $tokens = 1, float $maxTime = null): Reservation
6565
$now = microtime(true);
6666
$hitCount = $window->getHitCount();
6767
$availableTokens = $this->getAvailableTokens($hitCount);
68-
if ($tokens !== 0 && $availableTokens >= $tokens) {
68+
if (0 !== $tokens && $availableTokens >= $tokens) {
6969
$window->add($tokens);
7070

7171
$reservation = new Reservation($now, new RateLimit($this->getAvailableTokens($window->getHitCount()), \DateTimeImmutable::createFromFormat('U', floor($now)), true, $this->limit));

0 commit comments

Comments
 (0)
0