You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "November22 (via GitHub)" <gi...@apache.org> on 2023/02/07 11:13:37 UTC

[GitHub] [dubbo] November22 commented on a diff in pull request #11498: Enhanced support for Nacos weight configuration

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


##########
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:
   1. There is no flag to judge whether the weight of Nacos is modified,nacos will pass in the default weight of 1.0
   ![image](https://user-images.githubusercontent.com/26109828/217228731-a757836a-eced-43e1-8c60-b3aded3e2080.png)
   2. If it is not set in the example, 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;
   ![image](https://user-images.githubusercontent.com/26109828/217229356-4f469991-8e6a-42fb-86fa-b76c4f6ab681.png)
   



-- 
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-unsubscribe@dubbo.apache.org

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


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