From 2a73861c28202838d1f8b0c080d7b7dfb8dc90d9 Mon Sep 17 00:00:00 2001 From: Simon Bennett Date: Tue, 30 Mar 2021 14:39:44 +0100 Subject: [PATCH] [8.x] Explicitly set unit of sleep of retry function (#36810) * Explicitly set unit of sleep or retry functon * Update helpers.php Co-authored-by: Taylor Otwell --- src/Illuminate/Support/helpers.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Support/helpers.php b/src/Illuminate/Support/helpers.php index 660c34af55a2..85486f6bbc55 100755 --- a/src/Illuminate/Support/helpers.php +++ b/src/Illuminate/Support/helpers.php @@ -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; @@ -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;