You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/01/25 03:53:38 UTC

[GitHub] laijianbin closed pull request #527: [SCB-297] The local cache is not update when the server reboots at th?

laijianbin closed pull request #527: [SCB-297] The local cache is not update when the server reboots at th?
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/527
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/MicroserviceVersions.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/MicroserviceVersions.java
index 8a712bb22..04fbf1d37 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/MicroserviceVersions.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/MicroserviceVersions.java
@@ -25,6 +25,7 @@
 
 import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
 import org.apache.servicecomb.serviceregistry.RegistryUtils;
+import org.apache.servicecomb.serviceregistry.api.Const;
 import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
 import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstanceStatus;
 import org.apache.servicecomb.serviceregistry.api.response.MicroserviceInstanceChangedEvent;
@@ -195,11 +196,13 @@ protected MicroserviceVersionRule createAndInitMicroserviceVersionRule(String st
 
   @Subscribe
   public void onMicroserviceInstanceChanged(MicroserviceInstanceChangedEvent changedEvent) {
-    if (!appId.equals(changedEvent.getKey().getAppId()) ||
-        !microserviceName.equals(changedEvent.getKey().getServiceName())) {
+    boolean isEventAccept = appId.equals(changedEvent.getKey().getAppId()) &&
+        microserviceName.equals(changedEvent.getKey().getServiceName()) ||
+        microserviceName.equals(
+            changedEvent.getKey().getAppId() + Const.APP_SERVICE_SEPARATOR + changedEvent.getKey().getServiceName());
+    if (!isEventAccept) {
       return;
     }
-
     // pull instances always replace old instances, not append
     //
     // pull result and watch event sequence is not defined even inside SC.


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services