1kasa commented on code in PR #2843:
URL: https://github.com/apache/dubbo-go/pull/2843#discussion_r2051966901


##########
registry/nacos/registry.go:
##########
@@ -99,11 +99,22 @@ func createRegisterParam(url *common.URL, serviceName 
string, groupName string)
        params[constant.MethodsKey] = strings.Join(url.Methods, ",")
        common.HandleRegisterIPAndPort(url)
        port, _ := strconv.Atoi(url.Port)
+
+       weightStr := url.GetParam(constant.WeightKey, "1.0")
+       weight, err := strconv.ParseFloat(weightStr, 64)
+       if err != nil || weight <= constant.MinNacosWeight {
+               logger.Warnf("Invalid weight value %q, using default 1.0. err: 
%v", weightStr, err)
+               weight = constant.DefaultNacosWeight
+       } else if weight > constant.MaxNacosWeight {

Review Comment:
   Extracting the weight processing logic into a separate function may not be 
suitable because the logic in registry.go and service_discovery.go differs in 
context and implementation details. Creating a shared function would likely 
require introducing a new module to manage the common logic, increasing code 
complexity and maintenance overhead. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to