From 720e0926fa1c94b952c26e111206c5d6e1ed5ba2 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 21 四月 2026 15:59:49 +0800
Subject: [PATCH] Merge branch 'master' of http://47.97.1.152:5880/r/zy-wcs-master

---
 src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java b/src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java
index dd7cfd5..a644995 100644
--- a/src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java
+++ b/src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java
@@ -46,6 +46,7 @@
                 return false;
             }
             taskGuard.lastSubmitTimeMs = now;
+            taskGuard.lastQueueEnterTimeMs = now;
         }
 
         try {
@@ -64,6 +65,7 @@
                              TaskGuard taskGuard,
                              Runnable task) {
         long startMs = System.currentTimeMillis();
+        long queueWaitMs = taskGuard.lastQueueEnterTimeMs > 0L ? startMs - taskGuard.lastQueueEnterTimeMs : 0L;
         try {
             task.run();
         } catch (Exception e) {
@@ -71,7 +73,7 @@
         } finally {
             long costMs = System.currentTimeMillis() - startMs;
             if (slowLogThresholdMs > 0L && costMs > slowLogThresholdMs) {
-                log.warn("MainProcess async task executed slowly, lane={}, task={}, cost={}ms", laneName, taskName, costMs);
+                log.warn("MainProcess async task executed slowly, lane={}, task={}, cost={}ms, queueWaitMs={}ms", laneName, taskName, costMs, queueWaitMs);
             }
             taskGuard.running.set(false);
         }
@@ -137,6 +139,7 @@
 
         private final AtomicBoolean running = new AtomicBoolean(false);
         private volatile long lastSubmitTimeMs = 0L;
+        private volatile long lastQueueEnterTimeMs = 0L;
     }
 
     private static class NamedThreadFactory implements ThreadFactory {

--
Gitblit v1.9.1