From 9bbf32b28db3921330e0af201b8e08ac9330137a Mon Sep 17 00:00:00 2001 From: pini-girit Date: Tue, 11 May 2021 20:36:21 +0300 Subject: [PATCH] v1.14.9: Fixed an issue on BulkUpload --- Core/CloudinaryImageManager.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Core/CloudinaryImageManager.php b/Core/CloudinaryImageManager.php index f35dfeb..5502eeb 100644 --- a/Core/CloudinaryImageManager.php +++ b/Core/CloudinaryImageManager.php @@ -68,18 +68,17 @@ public function uploadAndSynchronise(Image $image, OutputInterface $output = nul } catch (\Exception $e) { if ($e->getMessage() === FileExists::DEFAULT_MESSAGE) { $this->report($output, sprintf(self::MESSAGE_UPLOADED_EXISTS, $image)); - return; - } + } else { + if ($retryAttempt < self::MAXIMUM_RETRY_ATTEMPTS) { + $retryAttempt++; + $this->report($output, sprintf(self::MESSAGE_RETRY, $e->getMessage(), $retryAttempt)); + usleep(rand(10, 1000) * 1000); + $this->uploadAndSynchronise($image, $output, $retryAttempt); + return; + } - if ($retryAttempt < self::MAXIMUM_RETRY_ATTEMPTS) { - $retryAttempt++; - $this->report($output, sprintf(self::MESSAGE_RETRY, $e->getMessage(), $retryAttempt)); - usleep(rand(10, 1000) * 1000); - $this->uploadAndSynchronise($image, $output, $retryAttempt); - return; + throw $e; } - - throw $e; } $this->synchronisationRepository->saveAsSynchronized($image->getRelativePath());