wujimin commented on a change in pull request #681: [SCB-526]fetch once from 
dynamic config source when boot up
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/681#discussion_r185523261
 
 

 ##########
 File path: 
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
 ##########
 @@ -128,24 +130,28 @@ public void connectServer() {
     } catch (InterruptedException e) {
       throw new IllegalStateException(e);
     }
-    refreshMembers(memberDiscovery);
-    EXECUTOR.scheduleWithFixedDelay(new ConfigRefresh(parseConfigUtils, 
memberDiscovery),
+    refreshMembers(memberDiscovery, true);
+    ConfigRefresh refreshTask = new ConfigRefresh(parseConfigUtils, 
memberDiscovery);
+    refreshTask.run(true);
+    EXECUTOR.scheduleWithFixedDelay(refreshTask,
         firstRefreshInterval,
         refreshInterval,
         TimeUnit.MILLISECONDS);
   }
 
-  private void refreshMembers(MemberDiscovery memberDiscovery) {
+  private void refreshMembers(MemberDiscovery memberDiscovery, boolean wait) {
     if (CONFIG_CENTER_CONFIG.getAutoDiscoveryEnabled()) {
       String configCenter = memberDiscovery.getConfigServer();
       IpPort ipPort = NetUtils.parseIpPortFromURI(configCenter);
+      CountDownLatch latch = new CountDownLatch(1);
       clientMgr.findThreadBindClientPool().runOnContext(client -> {
         HttpClientRequest request = client.get(ipPort.getPort(), 
ipPort.getHostOrIp(), URIConst.MEMBERS, rsp -> {
           if (rsp.statusCode() == HttpResponseStatus.OK.code()) {
             rsp.bodyHandler(buf -> {
               memberDiscovery.refreshMembers(buf.toJsonObject());
             });
           }
+          latch.countDown();
 
 Review comment:
   no need to wait response body?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to