[server] [rpc] - 修复rpc返回信息处理逻辑, 解决cpu过高的问题 - 1

This commit is contained in:
zeaslity
2023-02-17 11:17:30 +08:00
parent eb709a5566
commit 9197efc4ec
9 changed files with 50 additions and 17 deletions

View File

@@ -191,7 +191,7 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
);
*/
try {
// 超时等待5秒钟, 或者所有的Agent均已经完成上报
// 超时等待5秒钟, 或者所有的Agent均已经完成上报ddo
countDownLatch.await(
5,
TimeUnit.SECONDS
@@ -242,7 +242,6 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
}
@Override
public String shutdownAgentDanger(String agentTopicName) {
@@ -293,11 +292,9 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
)) {
// 不是当前应用需要的的OM将信息放置与Cache队列的末尾
try {
OCTOPUS_MESSAGE_FROM_AGENT.put(message);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
OCTOPUS_MESSAGE_FROM_AGENT.offer(message);
// 返回,继续死循环
continue;
}
@@ -346,11 +343,9 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
)) {
// 不是当前应用需要的的OM将信息放置与Cache队列的末尾
try {
OCTOPUS_MESSAGE_FROM_AGENT.put(message);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
OCTOPUS_MESSAGE_FROM_AGENT.offer(message);
// 返回,继续死循环
continue;
}

View File

@@ -73,6 +73,9 @@ public class AsyncWaitOMResult {
);
if (!REPLAY_CACHE_MAP.containsKey(matchKey)) {
// 没有这个Key,说明等待结果已经超时了,直接丢弃,然后继续循环
// todo 错误的数据需要放置于某处
continue;
}

View File

@@ -13,6 +13,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.concurrent.ArrayBlockingQueue;
@Configuration
@@ -29,9 +30,8 @@ public class OMessageHandlerServer {
* 各个业务模块需要自己手动去获取自己需要的内容
* TODO 数据一致性问题当AgentShutDown可能有一些信息会消失
*/
public static ArrayBlockingQueue<OctopusMessage> OCTOPUS_MESSAGE_FROM_AGENT = new ArrayBlockingQueue<>(
128,
true
public static ArrayDeque<OctopusMessage> OCTOPUS_MESSAGE_FROM_AGENT = new ArrayDeque<>(
128
);
@Resource
RedisTemplate redisTemplate;

View File

@@ -82,7 +82,7 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
futureExecutionResultKey
);
log.info("[ 定时脚本任务 ] - 新建任务成功, 船舰任务DTO为 => {}", scriptSchedulerDTO);
log.info("[ 定时脚本任务 ] - 新建任务成功, 任务DTO为 => {}", scriptSchedulerDTO);
log.info("[ 定时脚本任务 ] - 新建任务成功, 任务内容为 => {}", jobDetail);
// persistent the script scheduled mission

View File

@@ -18,3 +18,6 @@ spring:
extension-configs:
- group: local
data-id: common-local.yaml
server:
port: 9999