You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/05/14 09:59:13 UTC

[GitHub] [servicecomb-java-chassis] kaister3 opened a new pull request #2384: [#2381]fix initLatestVersion method

kaister3 opened a new pull request #2384:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2384


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2384: [#2381]fix initLatestVersion method

Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2384:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2384#discussion_r633246680



##########
File path: handlers/handler-router/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java
##########
@@ -140,9 +145,17 @@ public TagItem getFiltedServerTagItem(PolicyRuleItem rule, String targetServiceN
 
 
   public void initLatestVersion(String serviceName, List<T> list) {
-    if (RouterRuleCache.getServiceInfoCacheMap().get(serviceName).getLatestVersionTag() != null) {
-      return;
+    TagItem latestVersionTag = RouterRuleCache.getServiceInfoCacheMap().get(serviceName).getLatestVersionTag();
+
+    if (latestVersionTag != null) {
+      for (T server : list) {
+        E ms = getIns.apply(server);
+        if (getVersion.apply(ms).equals(latestVersionTag.getVersion())) {
+          return;
+        }
+      }
     }
+

Review comment:
       Maybe it's better to using API's in foundation-registry to find latest version. 
   While now, line 148~158 can be deleted, since if you check version match, will call getIns always, it it some as delete all these lines.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2384: [#2381]fix initLatestVersion method

Posted by GitBox <gi...@apache.org>.
liubao68 merged pull request #2384:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2384


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2384: [#2381]fix initLatestVersion method

Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2384:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2384#discussion_r633246680



##########
File path: handlers/handler-router/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java
##########
@@ -140,9 +145,17 @@ public TagItem getFiltedServerTagItem(PolicyRuleItem rule, String targetServiceN
 
 
   public void initLatestVersion(String serviceName, List<T> list) {
-    if (RouterRuleCache.getServiceInfoCacheMap().get(serviceName).getLatestVersionTag() != null) {
-      return;
+    TagItem latestVersionTag = RouterRuleCache.getServiceInfoCacheMap().get(serviceName).getLatestVersionTag();
+
+    if (latestVersionTag != null) {
+      for (T server : list) {
+        E ms = getIns.apply(server);
+        if (getVersion.apply(ms).equals(latestVersionTag.getVersion())) {
+          return;
+        }
+      }
     }
+

Review comment:
       Maybe it's better to using API's in foundation-registry to find latest version. 
   While now, line 148~158 can be deleted, since if you check version match, will call getIns always, it it some as delete all these lines.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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