Browse Source

同步安居客 算法执行完后循环检测upload.json是否存在

dengsixing 3 years ago
parent
commit
f2a4d3e8d8

+ 12 - 1
4dkankan-center-scene/src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -999,7 +999,18 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
             CreateObjUtil.build3dModel(target , "1");
             String uploadJsonPath = target + File.separator + "results" + File.separator + "upload.json";
             log.info("uploadJsonPath=" + uploadJsonPath);
-            if(!new File(uploadJsonPath).exists()){
+            //因为共享目录有延迟,这里循环检测算法是否计算完毕3次,每次隔五秒
+            int checkTimes = 1;
+            boolean exist = false;
+            do {
+                if(new File(uploadJsonPath).exists()){
+                    exist = true;
+                    break;
+                }
+                Thread.sleep(5000);
+                ++checkTimes;
+            }while (checkTimes <= 3);
+            if(!exist){
                 throw new BusinessException(ErrorCode.FAILURE_CODE_5042);
             }