AlexStocks commented on a change in pull request #548:
URL: https://github.com/apache/dubbo-go/pull/548#discussion_r434660692



##########
File path: config_center/nacos/client.go
##########
@@ -157,12 +135,23 @@ func newNacosClient(name string, nacosAddrs []string, 
timeout time.Duration) (*N
                },
        }
 
-       svrConfList := make([]nacosconst.ServerConfig, 0, len(n.NacosAddrs))
-       for _, nacosAddr := range n.NacosAddrs {
+       configClient, err := initNacosConfigClient(nacosAddrs, timeout, url)
+       if err != nil {
+               logger.Errorf("nacos create config client error:%v", err)

Review comment:
       logger.Errorf("initNacosConfigClient(addr:%+v, timeout:%v, url:%v) = 
errkor %+v", nacosAddrs, timeout, err)

##########
File path: config_center/nacos/client.go
##########
@@ -87,17 +88,16 @@ func ValidateNacosClient(container nacosClientFacade, opts 
...option) error {
        }
 
        url := container.GetUrl()
-
+       timeout, err := 
time.ParseDuration(url.GetParam(constant.REGISTRY_TIMEOUT_KEY, 
constant.DEFAULT_REG_TIMEOUT))
+       if err != nil {
+               logger.Errorf("timeout config %v is invalid ,err is %v",

Review comment:
       invalid timeout config %+v, got err %+v

##########
File path: config_center/nacos/client.go
##########
@@ -157,12 +135,23 @@ func newNacosClient(name string, nacosAddrs []string, 
timeout time.Duration) (*N
                },
        }
 
-       svrConfList := make([]nacosconst.ServerConfig, 0, len(n.NacosAddrs))
-       for _, nacosAddr := range n.NacosAddrs {
+       configClient, err := initNacosConfigClient(nacosAddrs, timeout, url)
+       if err != nil {
+               logger.Errorf("nacos create config client error:%v", err)
+               return n, perrors.WithMessagef(err, 
"newNacosClient(address:%+v)", url.Location)
+       }
+       n.SetClient(&configClient)
+
+       return n, nil
+}
+
+func initNacosConfigClient(nacosAddrs []string, timeout time.Duration, url 
common.URL) (config_client.IConfigClient, error) {
+       svrConfList := []nacosconst.ServerConfig{}
+       for _, nacosAddr := range nacosAddrs {
                split := strings.Split(nacosAddr, ":")
                port, err := strconv.ParseUint(split[1], 10, 64)
                if err != nil {
-                       logger.Warnf("convert port , source:%s , error:%v ", 
split[1], err)
+                       logger.Warnf("nacos addr port parse error ,error 
message is %v", err)

Review comment:
       logger.Warnf("strconv.ParseUint(nacos addr port:%+v) = error %+v", 
split[1], err)




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