Skip to content

Commit 6085d7a

Browse files
Merge pull request #2 from MohammadAlhallaq/main
add keys to the retry array
2 parents 02d58f0 + e514752 commit 6085d7a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Flaky.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function run(callable $callable)
5050
$value = null;
5151

5252
try {
53-
$value = retry($this->retry[0], $callable, $this->retry[1], $this->retry[2]);
53+
$value = retry($this->retry['times'], $callable, $this->retry['sleep'], $this->retry['when']);
5454
} catch (Throwable $e) {
5555
$failed = true;
5656
$exception = $e;
@@ -76,7 +76,9 @@ public function retry($times = 0, $sleepMilliseconds = 0, $when = null)
7676
{
7777
// We just store these for now and then use them in the `run` method.
7878
$this->retry = [
79-
$times, $sleepMilliseconds, $this->normalizeRetryWhen($when)
79+
'times' => $times,
80+
'sleep' => $sleepMilliseconds,
81+
'when' => $this->normalizeRetryWhen($when),
8082
];
8183

8284
return $this;

0 commit comments

Comments
 (0)