Skip to content
Snippets Groups Projects
Commit a7b3fd84 authored by 邹毅贤's avatar 邹毅贤
Browse files

fix review comment

parent bd165e54
No related branches found
No related tags found
No related merge requests found
......@@ -61,16 +61,14 @@ func WithNacosName(name string) option {
// ValidateNacosClient Validate nacos client , if null then create it
func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
var (
err error
)
if container == nil {
return perrors.Errorf("container can not be null")
}
os := &options{}
for _, opt := range opts {
opt(os)
}
err = nil
url := container.GetUrl()
if container.NacosClient() == nil {
......@@ -123,7 +121,7 @@ func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
}
}
return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.PrimitiveURL)
return perrors.WithMessagef(nil, "newNacosClient(address:%+v)", url.PrimitiveURL)
}
func newNacosClient(name string, nacosAddrs []string, timeout time.Duration) (*NacosClient, error) {
......@@ -147,6 +145,7 @@ func newNacosClient(name string, nacosAddrs []string, timeout time.Duration) (*N
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)
continue
}
svrconf := nacosconst.ServerConfig{
......
......@@ -159,9 +159,10 @@ func (n *nacosDynamicConfiguration) IsAvailable() bool {
func (r *nacosDynamicConfiguration) closeConfigs() {
r.cltLock.Lock()
defer r.cltLock.Unlock()
logger.Infof("begin to close provider nacos client")
// Close the old client first to close the tmp node
r.client.Close()
client := r.client
r.client = nil
r.cltLock.Unlock()
// Close the old client first to close the tmp node
client.Close()
logger.Infof("begin to close provider nacos client")
}
......@@ -57,5 +57,6 @@ func (l *nacosDynamicConfiguration) addListener(key string, listener config_cent
}
func (l *nacosDynamicConfiguration) removeListener(key string, listener config_center.ConfigurationListener) {
// TODO not supported in current go_nacos_sdk version
// TODO: not supported in current go_nacos_sdk version
logger.Warn("not supported in current go_nacos_sdk version")
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment