You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/06/03 15:37:31 UTC
[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #548: Update Nacos SDK version
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org