| @@ 97-104 (lines=8) @@ | ||
| 94 | /** |
|
| 95 | * @inheritdoc |
|
| 96 | */ |
|
| 97 | public function getRetryTimeout() |
|
| 98 | { |
|
| 99 | if ($this->threshold > $this->count() + 1) { |
|
| 100 | return 0; |
|
| 101 | } |
|
| 102 | ||
| 103 | return (int) ceil($this->timeLimit / $this->tokenlimit); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * @param int $tokenCount |
|
| @@ 111-118 (lines=8) @@ | ||
| 108 | * |
|
| 109 | * @return int |
|
| 110 | */ |
|
| 111 | private function getWaitTime($tokenCount) |
|
| 112 | { |
|
| 113 | if ($this->threshold > $tokenCount) { |
|
| 114 | return 0; |
|
| 115 | } |
|
| 116 | ||
| 117 | return (int) ceil($this->timeLimit / max(1, ($this->tokenlimit - $this->threshold))); |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * @param int $tokens |
|