[ Status ] optimize the code
This commit is contained in:
@@ -4,7 +4,8 @@ package io.wdd.rpc.controller;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.wdd.common.response.R;
|
||||
import io.wdd.rpc.init.AgentStatusCacheService;
|
||||
import io.wdd.rpc.scheduler.service.status.AgentAliveStatusMonitorService;
|
||||
import io.wdd.rpc.status.service.AsyncStatusService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -23,11 +24,14 @@ import static io.wdd.rpc.init.AgentStatusCacheService.*;
|
||||
public class StatusController {
|
||||
|
||||
@Resource
|
||||
AgentStatusCacheService agentStatusCacheService;
|
||||
AsyncStatusService asyncStatusService;
|
||||
|
||||
@Resource
|
||||
AgentAliveStatusMonitorService agentAliveStatusMonitorService;
|
||||
|
||||
@ApiOperation("[ Agent-状态 ] Map")
|
||||
@GetMapping("/agent/status")
|
||||
public R<Map<String, String>> GetAllAgentHealthyStatus() {
|
||||
public R<Map<String, Boolean>> GetAllAgentHealthyStatus() {
|
||||
|
||||
return R.ok(ALL_AGENT_STATUS_MAP);
|
||||
}
|
||||
@@ -76,7 +80,9 @@ public class StatusController {
|
||||
public R<Map<String, List<String>>> ManualUpdateAgentStatus() {
|
||||
|
||||
// 手动调用更新
|
||||
agentStatusCacheService.updateAgentStatusMapCache(agentAliveStatusMap);
|
||||
Map<String, Boolean> agentAliveStatusMap = asyncStatusService.AsyncCollectAgentAliveStatus(ALL_AGENT_TOPIC_NAME_LIST, 5);
|
||||
|
||||
agentAliveStatusMonitorService.updateAllAgentHealthyStatus(agentAliveStatusMap);
|
||||
|
||||
return R.ok(STATUS_AGENT_LIST_MAP);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user