November22 commented on code in PR #11498:
URL: https://github.com/apache/dubbo/pull/11498#discussion_r1098529567


##########
dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java:
##########
@@ -638,6 +639,12 @@ private URL buildURL(URL consumerURL, Instance instance) {
         return new DubboServiceAddressURL(url.getUrlAddress(), 
url.getUrlParam(), consumerURL, null);
     }
 
+
+    private void setWeight(Map<String, String> metadata, double nacosWeight) {
+        long weight = 
Math.round(org.apache.dubbo.rpc.cluster.Constants.DEFAULT_WEIGHT * nacosWeight);

Review Comment:
   > > If it is not set in the instance, Nacos sends 1.0 by default, and the 
calculated result according to the code logic is 100, which is consistent with 
the default weight of dubbo;
   > 
   > If dubbo has set `200` in url, then set nacos weight as `3`, the weight 
should be `600` as expected.
   
   Yes, because the weight field type of nacos is double, and the weight field 
type of dubbo is int, all weights set in nacos are multiplied by the default 
weight of 100, so that two decimal places are reserved; this logic is 
consistent in all instances;



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

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to