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

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

liubao68 commented on a change in pull request #937: [SCB-718]If auto discovery 
failed, will cause a dead cycle
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/937#discussion_r225122500
 
 

 ##########
 File path: 
service-registry/src/main/java/org/apache/servicecomb/serviceregistry/client/IpPortManager.java
 ##########
 @@ -73,10 +78,14 @@ public IpPortManager(ServiceRegistryConfig 
serviceRegistryConfig, InstanceCacheM
   // we have to do this operation after the first time setup has already done
   public void initAutoDiscovery() {
     if (!autoDiscoveryInited && 
this.serviceRegistryConfig.isRegistryAutoDiscovery()) {
-      instanceCacheManager.getOrCreate(REGISTRY_APP_ID,
+      InstanceCache cache = instanceCacheManager.getOrCreate(REGISTRY_APP_ID,
           REGISTRY_SERVICE_NAME,
           DefinitionConst.VERSION_RULE_LATEST);
-      autoDiscoveryInited = true;
+      if(cache.getInstanceMap().size() > 0) {
+       setAutoDiscoveryInited(true);
+      }else {
+               setAutoDiscoveryInited(false);
 
 Review comment:
   format code

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


> If auto discovery failed , will cause a dead cycle
> --------------------------------------------------
>
>                 Key: SCB-718
>                 URL: https://issues.apache.org/jira/browse/SCB-718
>             Project: Apache ServiceComb
>          Issue Type: Task
>            Reporter: laijianbin
>            Assignee: laijianbin
>            Priority: Major
>




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

Reply via email to