diff --git a/server/src/main/java/io/wdd/rpc/controller/AgentController.java b/server/src/main/java/io/wdd/rpc/controller/AgentController.java index 8e5f110..ed1c9c4 100644 --- a/server/src/main/java/io/wdd/rpc/controller/AgentController.java +++ b/server/src/main/java/io/wdd/rpc/controller/AgentController.java @@ -14,7 +14,7 @@ import java.util.Map; @RestController @RequestMapping("/octopus/server/agent") -@Api("处理Agent核心内容的Controller") +@Api(value = "处理Agent核心内容的Controller", tags = "Agent") public class AgentController { @Resource diff --git a/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java b/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java index d907e5c..9a6156f 100644 --- a/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java +++ b/server/src/main/java/io/wdd/rpc/controller/ExecutionController.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiParam; import io.wdd.common.beans.response.R; import io.wdd.rpc.execute.result.BuildStreamReader; import io.wdd.rpc.execute.service.AsyncExecutionService; +import io.wdd.rpc.execute.service.SyncExecutionService; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -28,6 +29,8 @@ public class ExecutionController { AsyncExecutionService asyncExecutionService; @Resource BuildStreamReader buildStreamReader; + @Resource + SyncExecutionService syncExecutionService; @PostMapping("/command/one") @ApiOperation("[命令] - 手动发送命令") @@ -104,11 +107,13 @@ public class ExecutionController { @RequestParam(value = "type", required = false) @ApiParam(name = "type", value = "执行命令类型") @Nullable String type ) { - return R.ok(asyncExecutionService.SendCommandToAgent( - ALL_HEALTHY_AGENT_TOPIC_NAME_LIST, - type, - commandList - )); + return R.ok( + syncExecutionService.SyncSendCommandToAgent( + topicName, + type, + commandList + ) + ); } diff --git a/server/src/main/java/io/wdd/rpc/controller/SchedulerController.java b/server/src/main/java/io/wdd/rpc/controller/SchedulerController.java index e52195a..c06d1d1 100644 --- a/server/src/main/java/io/wdd/rpc/controller/SchedulerController.java +++ b/server/src/main/java/io/wdd/rpc/controller/SchedulerController.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Map; @RestController -@Api(value = "定时任务控制中心的Controller") +@Api(value = "定时任务控制中心的Controller", tags = "Scheduler") @RequestMapping(value = "/octopus/server/scheduler") public class SchedulerController { diff --git a/server/src/main/java/io/wdd/rpc/controller/StatusController.java b/server/src/main/java/io/wdd/rpc/controller/StatusController.java index 068e6f9..bcaf7b4 100644 --- a/server/src/main/java/io/wdd/rpc/controller/StatusController.java +++ b/server/src/main/java/io/wdd/rpc/controller/StatusController.java @@ -18,7 +18,7 @@ import static io.wdd.rpc.init.ServerCacheAgentStatus.*; @RestController -@Api("Agent运行状态Controller") +@Api(value = "Agent运行状态Controller", tags = "Status") @RequestMapping("/octopus/server/status") public class StatusController { diff --git a/server/src/main/java/io/wdd/rpc/execute/service/SyncExecutionServiceImpl.java b/server/src/main/java/io/wdd/rpc/execute/service/SyncExecutionServiceImpl.java index cfddef8..5949c89 100644 --- a/server/src/main/java/io/wdd/rpc/execute/service/SyncExecutionServiceImpl.java +++ b/server/src/main/java/io/wdd/rpc/execute/service/SyncExecutionServiceImpl.java @@ -5,7 +5,6 @@ import io.wdd.common.beans.rabbitmq.OctopusMessageType; import io.wdd.rpc.message.handler.AsyncWaitOMResult; import io.wdd.rpc.message.handler.OMReplayContend; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,8 +31,7 @@ public class SyncExecutionServiceImpl implements SyncExecutionService { /** * 一个命令执行的最长等待时间 */ - @Value("${octopus.agent.executor.processMaxTimeOut}") - Integer processMaxWaitSeconds; + int processMaxWaitSeconds = 10; @Override public ArrayList SyncSendCommandToAgent(String agentTopicName, List commandList) { @@ -179,10 +177,14 @@ public class SyncExecutionServiceImpl implements SyncExecutionService { ArrayList result = new ArrayList<>(); // 构造消息等待对象 - int commandCount = Math.max( - commandListComplete.size(), - 1 - ); + int commandCount = 1; + if (null != commandListComplete) { + commandCount = Math.max( + commandListComplete.size(), + 1 + ); + } + OMReplayContend omReplayContend = OMReplayContend.build( commandCount, CurrentAppOctopusMessageType,