ソースを参照

增加休眠时间,减少冲突

周箭河 4 年 前
コミット
85bd6d0995

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -301,7 +301,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         if (chargeInfo.getMaxNum() != null) {
             if(chargeInfo.getMaxNum() <= chargeInfo.getPaidNum()){
-                throw new BizException("活动人数暂时已满,请稍后再试");
+                throw new Exception("活动人数暂时已满,请稍后再试");
             }
             chargeInfo.setPaidNum(chargeInfo.getPaidNum() + 1);
             chargeInfo.setUpdateTime(new Date());

+ 8 - 5
mec-student/src/main/java/com/ym/mec/student/controller/SporadicChargeInfoController.java

@@ -72,7 +72,7 @@ public class SporadicChargeInfoController extends BaseController {
         }
         SporadicChargeInfo info = sporadicChargeInfoService.get(sporadicPayDto.getSporadicId());
 
-        if(info.getMaxNum() != null) {
+        if (info.getMaxNum() != null) {
             String msg = "";
             for (int i = 1; i <= 100; i++) {
                 try {
@@ -82,11 +82,14 @@ public class SporadicChargeInfoController extends BaseController {
                     }
                     return succeed(payMap);
                 } catch (Exception e) {
-                    int max = 100, min = 1;
-                    int times = (int) (Math.random() * (max - min) + min);
-                    Thread.sleep(times);
                     msg = e.getMessage();
-                    continue;
+                    if (e instanceof BizException) {
+                        int max = 100, min = 1;
+                        int times = (int) (Math.random() * (max - min) + min);
+                        Thread.sleep(times);
+                        continue;
+                    }
+                    break;
                 }
             }
             return failed(msg);