From db5338c2246acbc0826a9b683392512cf00eba04 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期日, 26 三月 2023 09:11:32 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/config/ScheduleConfig.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/lf/server/config/ScheduleConfig.java b/src/main/java/com/lf/server/config/ScheduleConfig.java
index 5b937f1..d818805 100644
--- a/src/main/java/com/lf/server/config/ScheduleConfig.java
+++ b/src/main/java/com/lf/server/config/ScheduleConfig.java
@@ -28,6 +28,8 @@
     @Autowired
     ScheduleService scheduleService;
 
+    private static boolean isBusy = false;
+
     private static final Log log = LogFactory.getLog(ScheduleConfig.class);
 
     @Scheduled(fixedRate = 15 * 1000)
@@ -98,15 +100,18 @@
     public void syncAttaches() {
         try {
             List<FmeLogEntity> list = attachService.selectFmeLogs();
-            if (null == list || list.isEmpty()) {
+            if (isBusy || null == list || list.isEmpty()) {
                 return;
             }
 
+            isBusy = true;
             for (FmeLogEntity entity : list) {
-                attachService.updateFmeLog(entity.getId());
                 attachService.syncAttaches(entity);
+                attachService.updateFmeLog(entity.getId());
             }
+            isBusy = false;
         } catch (Exception ex) {
+            isBusy = false;
             log.error(ex.getMessage(), ex);
         }
     }

--
Gitblit v1.9.3