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