Skip to content

Commit

Permalink
[8.x] Explicitly set unit of sleep of retry function (#36810)
Browse files Browse the repository at this point in the history
* Explicitly set unit of sleep or retry functon

* Update helpers.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
mrsimonbennett and taylorotwell authored Mar 30, 2021
1 parent a274fc7 commit 2a73861
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ function preg_replace_array($pattern, array $replacements, $subject)
*
* @param int $times
* @param callable $callback
* @param int $sleep
* @param int $sleepMilliseconds
* @param callable|null $when
* @return mixed
*
* @throws \Exception
*/
function retry($times, callable $callback, $sleep = 0, $when = null)
function retry($times, callable $callback, $sleepMilliseconds = 0, $when = null)
{
$attempts = 0;

Expand All @@ -237,8 +237,8 @@ function retry($times, callable $callback, $sleep = 0, $when = null)
throw $e;
}

if ($sleep) {
usleep($sleep * 1000);
if ($sleepMilliseconds) {
usleep($sleepMilliseconds * 1000);
}

goto beginning;
Expand Down

0 comments on commit 2a73861

Please sign in to comment.