Call all compound limiters on failure and added IO blocking
This commit is contained in:
parent
aa661492d2
commit
0279f88e6c
@ -37,10 +37,6 @@ final class CompoundLimiter implements LimiterInterface
|
||||
foreach ($this->limiters as $limiter) {
|
||||
$limit = $limiter->consume($tokens);
|
||||
|
||||
if (0 === $limit->getRemainingTokens()) {
|
||||
return $limit;
|
||||
}
|
||||
|
||||
if (null === $minimalLimit || $limit->getRemainingTokens() < $minimalLimit->getRemainingTokens()) {
|
||||
$minimalLimit = $limit;
|
||||
}
|
||||
|
@ -43,4 +43,9 @@ class Limit
|
||||
{
|
||||
return $this->availableTokens;
|
||||
}
|
||||
|
||||
public function wait(): void
|
||||
{
|
||||
sleep(($this->retryAfter->getTimestamp() - time()) * 1e6);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user