Commit efeae947 by huangfusuper

解决报错信息重复打印BUG

parent 48f910e6
...@@ -78,13 +78,16 @@ public class RequestUtil { ...@@ -78,13 +78,16 @@ public class RequestUtil {
retryRpcHost(client, host, runKey, retryTotalCount, ++thisRetryCount); retryRpcHost(client, host, runKey, retryTotalCount, ++thisRetryCount);
} }
if (thisRetryCount == 1) {
String format = String.format("与主机【%s】建立通道,总共【%s】次,全部失败,开始挑选下一个负载均衡方案重试,请稍后", host, retryTotalCount);
StringRedisTemplate stringRedisTemplate = RpcSpringUtil.getBean(StringRedisTemplate.class);
RunLog runLog = RunLog.builder().runLog(format).isEnd(false).build();
stringRedisTemplate.opsForList().rightPush(runKey, JSON.toJSONString(runLog, WriteClassName));
log.error(format);
}
String format = String.format("与主机【%s】建立通道,总共【%s】次,全部失败,开始挑选下一个负载均衡方案重试,请稍后", host, retryTotalCount);
StringRedisTemplate stringRedisTemplate = RpcSpringUtil.getBean(StringRedisTemplate.class);
RunLog runLog = RunLog.builder().runLog(format).isEnd(false).build();
stringRedisTemplate.opsForList().rightPush(runKey, JSON.toJSONString(runLog, WriteClassName));
log.error(format);
return false; return false;
} }
} }
......
...@@ -69,12 +69,17 @@ public class ClientRpcUtil { ...@@ -69,12 +69,17 @@ public class ClientRpcUtil {
Thread.sleep(1000 * thisRetryCount); Thread.sleep(1000 * thisRetryCount);
retryRpcHost(client, host,runKey, retryTotalCount, ++thisRetryCount); retryRpcHost(client, host,runKey, retryTotalCount, ++thisRetryCount);
} }
String format = String.format("与主机【%s】建立通道,总共【%s】次,全部失败,开始挑选下一个负载均衡方案重试,请稍后", host, retryTotalCount);
//redis模板
StringRedisTemplate stringRedisTemplate = SpringUtil.getBean(StringRedisTemplate.class); if(thisRetryCount == 1){
RunLog runLog = RunLog.builder().runLog(format).isEnd(false).build(); String format = String.format("与主机【%s】建立通道,总共【%s】次,全部失败,开始挑选下一个负载均衡方案重试,请稍后", host, retryTotalCount);
stringRedisTemplate.opsForList().rightPush(runKey, JSON.toJSONString(runLog, WriteClassName)); //redis模板
log.error(format); StringRedisTemplate stringRedisTemplate = SpringUtil.getBean(StringRedisTemplate.class);
RunLog runLog = RunLog.builder().runLog(format).isEnd(false).build();
stringRedisTemplate.opsForList().rightPush(runKey, JSON.toJSONString(runLog, WriteClassName));
log.error(format);
}
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment