From 831c63c4ec9e52e28f6fde520e45f1b3a6cd50b0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 12 Dec 2024 18:34:05 +0100 Subject: [PATCH] wait #7230 @1 --- app/Services/ScormCloud.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Services/ScormCloud.php b/app/Services/ScormCloud.php index e240c376e..73219cd44 100644 --- a/app/Services/ScormCloud.php +++ b/app/Services/ScormCloud.php @@ -37,7 +37,7 @@ class ScormCloud /** * @throws ApiException */ - public static function send($url, $courseId, $delete = true) + public static function send($url, $courseId, $delete = true, $attempts = 3) { $courseAPI = static::_getApi(); @@ -76,11 +76,18 @@ class ScormCloud } - if ($delete) { - static::deleteOldVersions($courseId); + try { + if ($delete) { + static::deleteOldVersions($courseId); + } + } catch (\Exception $e) { + if ($attempts >= 1) { + sleep(5); + return static::send($url, $courseId, $delete, $attempts - 1); + } } - return 'https://cloud.scorm.com/sc/user/Course?appId=' . self::getAppID() . '&courseId=' . $courseId; + return 'https://cloud.scorm.com/sc/user/Course?appId=' . self::getAppID() . '&courseId=' . $courseId . '&attempts=' . $attempts; } /** -- 2.39.5