From bf2b6ebfddf887c53adb734fbbf3f09d9a8f0ab0 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Mon, 5 Sep 2016 11:43:00 +0200
Subject: [PATCH] hotline #44903 : on record image cache generation, add
 automatic retry if fail

---
 public/admin/js/cacheimages.js | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/public/admin/js/cacheimages.js b/public/admin/js/cacheimages.js
index 203f685bea5..616884f5720 100644
--- a/public/admin/js/cacheimages.js
+++ b/public/admin/js/cacheimages.js
@@ -1,10 +1,18 @@
-////////////////////////////////////////////////////////////////////////////////////
-// Constitution du cache des images
-///////////////////////////////////////////////////////////////////////////////////
-function makeCacheImages(sUrl)
-{
-	if(!sUrl) sUrl=baseUrl+'/admin/systeme/makecacheimages';
-	else sUrl=baseUrl+sUrl;
-	$('#bloc_restantes').show();
-	$('#restantes').load(sUrl);
-}
\ No newline at end of file
+// See module/admin/controllers/SystemeController.php makecacheimagesAction()
+function makeCacheImages(sUrl) {
+        if (!sUrl) 
+          sUrl = baseUrl+'/admin/systeme/makecacheimages';
+        else 
+          sUrl = baseUrl+sUrl;
+
+        $('#bloc_restantes').show();
+        $('#restantes').load(sUrl, 
+                             function(response, status, xhr) {
+                               if (status == "error") {
+                                 $('#restantes').append('.');
+                                 setTimeout(function() { makeCacheImages(); },
+                                            1);
+                                            
+                               }
+                             });
+}
-- 
GitLab