liubao68 commented on code in PR #4747:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/4747#discussion_r2009746806
##########
handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/ServiceCombLoadBalancerStats.java:
##########
@@ -164,10 +169,21 @@ public void run() {
try {
Map<ServiceCombServer, ServiceCombServerStats> allServers = pingView;
allServers.forEach((server, stats) -> {
- if ((System.currentTimeMillis() - stats.getLastVisitTime() >
timerIntervalInMillis) && !ping
- .ping(server.getInstance())) {
- LOGGER.info("ping mark server {} failure.",
server.getInstance().getInstanceId());
- stats.markFailure();
+ //get all microservice instances
+ MicroserviceVersions microserviceVersions =
DiscoveryManager.INSTANCE.getOrCreateMicroserviceVersions(
+ RegistrationManager.INSTANCE.getAppId() ,
server.getMicroserviceName());
+ List<MicroserviceInstance> microserviceInstanceList =
microserviceVersions.getInstances();
+ for (MicroserviceInstance instance:microserviceInstanceList){
+ //check if the instance still up
+ if
(server.getInstance().getInstanceId().equals(instance.getInstanceId())){
+ //check test interval
+ if ((System.currentTimeMillis() - stats.getLastVisitTime() >
timerIntervalInMillis)
+ && !ping.ping(server.getInstance())){
Review Comment:
Code indention is not correct. Do you use code template provided in
$project/etc ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]