瀏覽代碼

打印失败日志

dengsixing 3 年之前
父節點
當前提交
3cfc25905e

+ 14 - 2
4dkankan-center-scene-download/src/main/java/com/fdkankan/download/service/impl/SceneDownloadHandlerServiceImpl.java

@@ -243,7 +243,6 @@ public class SceneDownloadHandlerServiceImpl {
             // TODO: 2022/5/24 v3 停止后要开启-----------------------end
 
         }catch (Exception e){
-            Thread.sleep(30000);
             //更新进度为下载失败
             this.updateProgress( null, num, SceneDownloadProgressStatus.DOWNLOAD_FAILED.code(), null);
             //更新下载log状态为成功
@@ -261,6 +260,9 @@ public class SceneDownloadHandlerServiceImpl {
 
     private void zipOssFiles(ZipOutputStream out, List<String> ossFilePaths, String num, AtomicInteger count,
         int total, String resolution, int imagesVersion, Set<String> cacheKeys) throws Exception{
+        if(CollUtil.isEmpty(ossFilePaths)){
+            return;
+        }
         String imageNumPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
         ExecutorService executorService = Executors.newFixedThreadPool(this.zipNthreads);
         List<Future> futureList = new ArrayList<>();
@@ -276,9 +278,19 @@ public class SceneDownloadHandlerServiceImpl {
             futureList.add(executorService.submit(call));
         }
         //这里一定要加阻塞,不然会导致oss文件还没打包好,主程序已经结束返回了
+        Boolean zipSuccess = true;
         for (Future future : futureList) {
-            future.get();
+            try {
+                future.get();
+            }catch (Exception e){
+                log.error("打包oss文件失败", e);
+                zipSuccess = false;
+            }
+        }
+        if(!zipSuccess){
+            throw new Exception("打包oss文件失败");
         }
+
     }
 
     private void zipOssFilesHandler(ZipOutputStream out, String num,