Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
43 | 13 | private function retryAcquire(int $timeout, callable $callback): bool |
|
44 | { |
||
45 | 13 | $start = microtime(true); |
|
46 | |||
47 | do { |
||
48 | 13 | if ($callback()) { |
|
49 | 12 | return true; |
|
50 | } |
||
51 | 6 | usleep($this->retryDelay * 1000); |
|
52 | 6 | } while (microtime(true) - $start < $timeout); |
|
53 | |||
54 | 5 | return false; |
|
55 | } |
||
57 |