From 2cb57ab4a12dcc960018e253c9911ce977f48215 Mon Sep 17 00:00:00 2001 From: dongjianhui03 Date: Tue, 9 Nov 2021 11:39:55 +0800 Subject: [PATCH] [#1573]remove rootpath field in nacos&add ZkDefaultGroup constant --- config_center/dynamic_configuration.go | 6 +++--- config_center/nacos/impl.go | 9 +++------ config_center/zookeeper/impl.go | 6 +++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/config_center/dynamic_configuration.go b/config_center/dynamic_configuration.go index 69f84213e7..a7a8e5a2a7 100644 --- a/config_center/dynamic_configuration.go +++ b/config_center/dynamic_configuration.go @@ -34,10 +34,10 @@ import ( // DynamicConfiguration // //////////////////////////////////////// const ( - // DEFAULT_GROUP: default group + // DEFAULT_GROUP default group DEFAULT_GROUP = "dubbo" - // DEFAULT_CONFIG_TIMEOUT: default config timeout - DEFAULT_CONFIG_TIMEOUT = "10s" + // ZK_DEFAULT_GROUP default group of zk + ZK_DEFAULT_GROUP = "dubbo" ) // DynamicConfiguration for modify listener and get properties file diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go index a68a25a501..5d22cdc0e0 100644 --- a/config_center/nacos/impl.go +++ b/config_center/nacos/impl.go @@ -31,7 +31,6 @@ import ( import ( "github.com/apache/dubbo-go/common" - "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/config_center/parser" @@ -49,7 +48,6 @@ const ( type nacosDynamicConfiguration struct { config_center.BaseDynamicConfiguration url *common.URL - rootPath string wg sync.WaitGroup cltLock sync.Mutex done chan struct{} @@ -60,13 +58,12 @@ type nacosDynamicConfiguration struct { func newNacosDynamicConfiguration(url *common.URL) (*nacosDynamicConfiguration, error) { c := &nacosDynamicConfiguration{ - rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.DEFAULT_GROUP) + "/config", - url: url, - done: make(chan struct{}), + url: url, + done: make(chan struct{}), } err := ValidateNacosClient(c) if err != nil { - logger.Errorf("nacos client start error ,error message is %v", err) + logger.Errorf("nacos client start error, error message is %v", err) return nil, err } c.wg.Add(1) diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go index e0d8bcdcc0..fa6ae1a00e 100644 --- a/config_center/zookeeper/impl.go +++ b/config_center/zookeeper/impl.go @@ -62,11 +62,11 @@ type zookeeperDynamicConfiguration struct { func newZookeeperDynamicConfiguration(url *common.URL) (*zookeeperDynamicConfiguration, error) { c := &zookeeperDynamicConfiguration{ url: url, - rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.DEFAULT_GROUP) + "/config", + rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.ZK_DEFAULT_GROUP) + "/config", } err := zookeeper.ValidateZookeeperClient(c, ZkClient) if err != nil { - logger.Errorf("zookeeper client start error ,error message is %v", err) + logger.Errorf("zookeeper client start error, error message is %v", err) return nil, err } c.wg.Add(1) @@ -227,7 +227,7 @@ func (c *zookeeperDynamicConfiguration) getPath(key string, group string) string func (c *zookeeperDynamicConfiguration) buildPath(group string) string { if len(group) == 0 { - group = config_center.DEFAULT_GROUP + group = config_center.ZK_DEFAULT_GROUP } return c.rootPath + pathSeparator + group }