Skip to content

Commit

Permalink
add sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 13, 2016
1 parent e3bd359 commit 52e9381
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Illuminate/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,10 @@ function preg_replace_array($pattern, array $replacements, $subject)
*
* @param int $times
* @param callable $callback
* @param int $sleep
* @return mixed
*/
function retry($times, callable $callback)
function retry($times, callable $callback, $sleep = 0)
{
$times--;

Expand All @@ -628,6 +629,10 @@ function retry($times, callable $callback)

$times--;

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

goto beginning;
}
}
Expand Down

0 comments on commit 52e9381

Please sign in to comment.