[ 
https://issues.apache.org/jira/browse/SCB-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16357760#comment-16357760
 ] 

ASF GitHub Bot commented on SCB-294:
------------------------------------

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:
[email protected]


> when send a request to a not exist microservice, edge will always try to find 
> instances of it.
> ----------------------------------------------------------------------------------------------
>
>                 Key: SCB-294
>                 URL: https://issues.apache.org/jira/browse/SCB-294
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>            Reporter: wujimin
>            Assignee: liubao
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to