| @@ 181-188 (lines=8) @@ | ||
| 178 | /** |
|
| 179 | * @inheritdoc |
|
| 180 | */ |
|
| 181 | public function getRetryTimeout() |
|
| 182 | { |
|
| 183 | if ($this->threshold > $this->count() + 1) { |
|
| 184 | return 0; |
|
| 185 | } |
|
| 186 | ||
| 187 | return (int) ceil($this->timeLimit / $this->tokenlimit); |
|
| 188 | } |
|
| 189 | ||
| 190 | /** |
|
| 191 | * @param int $tokenCount |
|
| @@ 195-202 (lines=8) @@ | ||
| 192 | * |
|
| 193 | * @return int |
|
| 194 | */ |
|
| 195 | private function getWaitTime($tokenCount) |
|
| 196 | { |
|
| 197 | if ($this->threshold > $tokenCount) { |
|
| 198 | return 0; |
|
| 199 | } |
|
| 200 | ||
| 201 | return (int) ceil($this->timeLimit / max(1, ($this->tokenlimit - $this->threshold))); |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * @param int $tokens |
|