From d8684a77360fc36b962640a0c8b0d7540a647d1c Mon Sep 17 00:00:00 2001 From: lixiaolong <702156524@qq.com> Date: Thu, 9 Apr 2026 14:42:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor(flow):=20=E4=BC=98=E5=8C=96=E6=9A=82?= =?UTF-8?q?=E5=81=9C=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91=E4=BB=A5=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=81=9C=E6=AD=A2=E8=BE=B9=E7=BC=98=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将边缘端停止操作改为异步执行避免阻塞主线程 - 添加日志记录开始暂停操作 - 保持原有的暂停状态设置和时间戳更新逻辑 - 继续使用统一的日志记录和状态同步机制 --- .../com/cmvr/test/flow/control/FlowControlService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmvr-iot-test/src/main/java/com/cmvr/test/flow/control/FlowControlService.java b/cmvr-iot-test/src/main/java/com/cmvr/test/flow/control/FlowControlService.java index c9af14c..6bd6b73 100644 --- a/cmvr-iot-test/src/main/java/com/cmvr/test/flow/control/FlowControlService.java +++ b/cmvr-iot-test/src/main/java/com/cmvr/test/flow/control/FlowControlService.java @@ -78,11 +78,16 @@ public class FlowControlService { if (ctx.isPaused()) { throw new GlobalException("任务已处于暂停状态"); } - edgeSystemService.stopAll(ctx.getTerminalId()); + + log.info("开始暂停"); ctx.setPaused(true); ctx.setTerminalStatus(TerminalStatusEnum.RUNNING); ctx.setStatus(TaskStatusEnum.PAUSED); ctx.updateTimestamp(); + // 异步停止所有边缘端 + executor.execute(() -> { + edgeSystemService.stopAll(ctx.getTerminalId()); + }); // 统一记录日志 + 设置上下文状态 + 数据库状态 taskInstHolder.syncStatus(instId, TaskStatusEnum.PAUSED); taskThreadRegistry.interruptAll(instId);