8000 Fix sleep value · symfony/symfony@cf66399 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf66399

Browse files
committed
Fix sleep value
1 parent 54209bb commit cf66399

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/RateLimiter/RateLimit.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public function getLimit(): int
6767

6868
public function wait(): void
6969
{
70-
sleep(($this->retryAfter->getTimestamp() - time()) * 1e6);
70+
$delta = $this->retryAfter->getTimestamp() - time();
71+
if ($delta <= 0) {
72+
return;
73+
}
74+
75+
sleep($delta);
7176
}
7277
}

0 commit comments

Comments
 (0)
0