This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new f38357830 [SCB-2682]client component: fix problem when service center 
not available invocation will fail has been successfully created (#3333)
f38357830 is described below

commit f38357830e260ba7c24b3ae5cb771e931a31cbaa
Author: liubao68 <[email protected]>
AuthorDate: Tue Sep 13 16:20:56 2022 +0800

    [SCB-2682]client component: fix problem when service center not available 
invocation will fail has been successfully created (#3333)
---
 .../servicecomb/service/center/client/ServiceCenterDiscovery.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
 
b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
index 6406325a0..ccc8fb169 100644
--- 
a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
+++ 
b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java
@@ -17,6 +17,7 @@
 
 package org.apache.servicecomb.service.center.client;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -186,7 +187,11 @@ public class ServiceCenterDiscovery extends AbstractTask {
       }
     } catch (Exception e) {
       LOGGER.error("find service {}#{} instance failed.", k.appId, 
k.serviceName, e);
-      failedKeys.add(k);
+      if (!(e.getCause() instanceof IOException)) {
+        // for IOException, do not remove cache, or when service center
+        // not available, invocation between microservices will fail.
+        failedKeys.add(k);
+      }
     }
     return failedKeys;
   }

Reply via email to