]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7230 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Dec 2024 17:34:05 +0000 (18:34 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Dec 2024 17:34:05 +0000 (18:34 +0100)
app/Services/ScormCloud.php

index e240c376e07813aadd205df64c09ac70364bcad4..73219cd4468ed24998f2611f566530925e9a100f 100644 (file)
@@ -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;
     }
 
     /**