servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] wujimin commented on a change in pull request #552: [SCB-294]when send a request to a not exist microservice, edge will always try to find instances of it
Date Thu, 01 Jan 1970 00:00:00 GMT
wujimin commented on a change in pull request #552: [SCB-294]when send a request to a not exist
microservice, edge will always try to find instances of it
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/552#discussion_r167112433
 
 

 ##########
 File path: service-registry/src/main/java/org/apache/servicecomb/serviceregistry/consumer/MicroserviceManager.java
 ##########
 @@ -41,11 +47,31 @@ public MicroserviceManager(AppManager appManager, String appId) {
   }
 
   public MicroserviceVersions getOrCreateMicroserviceVersions(String microserviceName) {
-    return versionsByName.computeIfAbsent(microserviceName, name -> {
+    MicroserviceVersions microserviceVersions = versionsByName.computeIfAbsent(microserviceName,
name -> {
       MicroserviceVersions instance = new MicroserviceVersions(appManager, appId, microserviceName);
       instance.submitPull();
       return instance;
     });
+    if (!microserviceVersions.isValidated()) {
+      // remove this microservice if it does not exist or not registered in order to get
it back when access it again
+      versionsByName.remove(microserviceName);
+    } else {
+      microserviceVersions.updateLastAccessTime();
+    }
+    if (versionsByName.size() >= MAX_NUM_OF_MICROSERVICES) {
 
 Review comment:
   i'm not sure if it is right.
   think about edge, if realy need route to so many targets, this logic will cause problem.

----------------------------------------------------------------
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

Mime
View raw message