From bf9f5d506d34cbbcc68f77cdf71e30a6cf3cd7d4 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 09 八月 2023 13:50:07 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/config/ScheduleConfig.java | 8 ++++++-- 1 files changed, 6 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 b1d6801..1fbe663 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) @@ -82,7 +84,6 @@ jsonObject.put("operateCount", scheduleService.operateCount()); // 璧勬簮璋冪敤鐘舵�� - String json = JSONObject.toJSONStringWithDateFormat(jsonObject, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue); WebSocketService.broadCastInfo(json); @@ -98,15 +99,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.syncAttaches(entity); attachService.updateFmeLog(entity.getId()); } + isBusy = false; } catch (Exception ex) { + isBusy = false; log.error(ex.getMessage(), ex); } } -- Gitblit v1.9.3