[GitHub] liubao68 commented on a change in pull request #842: [SCB-782]support revision check when use pull mode with config center

2018-07-30 Thread GitBox
liubao68 commented on a change in pull request #842: [SCB-782]support revision 
check when use pull mode with config center
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/842#discussion_r206023906
 
 

 ##
 File path: 
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ParseConfigUtils.java
 ##
 @@ -40,13 +40,20 @@
 
   public static final Map flatItems = new HashMap<>();
 
+  public static String CURRENT_VERSION_INFO = "default";
+
   private UpdateHandler updateHandler;
 
   public ParseConfigUtils(UpdateHandler updateHandler) {
 this.updateHandler = updateHandler;
   }
 
   public void refreshConfigItems(Map> remoteItems) 
{
+
+CURRENT_VERSION_INFO = remoteItems.getOrDefault("revision",new 
HashMap<>()).getOrDefault("version","default").toString();
+//make sure the CURRENT_VERSION_INFO != ""
+CURRENT_VERSION_INFO = CURRENT_VERSION_INFO.equals("") ? "default" : 
CURRENT_VERSION_INFO;
+remoteItems.remove("revision");//the key revision is not the config setting
 
 Review comment:
   How about users have a key named revision?


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


[GitHub] liubao68 commented on a change in pull request #842: [SCB-782]support revision check when use pull mode with config center

2018-07-30 Thread GitBox
liubao68 commented on a change in pull request #842: [SCB-782]support revision 
check when use pull mode with config center
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/842#discussion_r206023617
 
 

 ##
 File path: 
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
 ##
 @@ -375,15 +374,17 @@ public void refreshConfig(String configcenter, boolean 
wait) {
   }
   latch.countDown();
 });
-  } else {
+  }else if (rsp.statusCode() == 
HttpResponseStatus.NOT_MODIFIED.code()){
+latch.countDown();
+  }else {
 rsp.bodyHandler(buf -> {
   LOGGER.error("Server error message is [{}].", buf);
   latch.countDown();
 });
 EventManager.post(new ConnFailEvent("fetch config fail"));
 LOGGER.error("Config refresh from {} failed.", configcenter);
   }
-});
+}).setTimeout((BOOTUP_WAIT_TIME -1 )* 1000);
 
 Review comment:
   Thread control based on timeout may not be accurate. The pulling operation 
can be changed to blocking, but this code can not guarantee each pull run 
sequencially. 


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


[GitHub] liubao68 commented on a change in pull request #842: [SCB-782]support revision check when use pull mode with config center

2018-07-30 Thread GitBox
liubao68 commented on a change in pull request #842: [SCB-782]support revision 
check when use pull mode with config center
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/842#discussion_r206022756
 
 

 ##
 File path: 
dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/client/ConfigCenterClient.java
 ##
 @@ -375,15 +374,17 @@ public void refreshConfig(String configcenter, boolean 
wait) {
   }
   latch.countDown();
 });
-  } else {
+  }else if (rsp.statusCode() == 
HttpResponseStatus.NOT_MODIFIED.code()){
 
 Review comment:
   Please use $HOME/etc/**.xml file to 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:
us...@infra.apache.org


With regards,
Apache Git Services