You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/04/30 09:55:52 UTC

[dubbo-go] branch 3.0 updated: add nacos updateCacheWhenEmpty (#1852)

This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new e92d63592 add nacos updateCacheWhenEmpty (#1852)
e92d63592 is described below

commit e92d63592af5ecc6337680d6cdf77341efc8c54f
Author: binbin.zhang <bb...@163.com>
AuthorDate: Sat Apr 30 17:55:47 2022 +0800

    add nacos updateCacheWhenEmpty (#1852)
---
 common/constant/key.go    |  1 +
 remoting/nacos/builder.go | 33 +++++++++++++++++----------------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/common/constant/key.go b/common/constant/key.go
index 98bd73b04..a81b5a24f 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -251,6 +251,7 @@ const (
 	NacosUsername             = "nacos.username"
 	NacosPassword             = "nacos.password"
 	NacosTimeout              = "nacos.timeout"
+	NacosUpdateCacheWhenEmpty = "nacos.updateCacheWhenEmpty"
 )
 
 const (
diff --git a/remoting/nacos/builder.go b/remoting/nacos/builder.go
index fe5acf310..8f1f0b84e 100644
--- a/remoting/nacos/builder.go
+++ b/remoting/nacos/builder.go
@@ -87,22 +87,23 @@ func GetNacosConfig(url *common.URL) ([]nacosConstant.ServerConfig, nacosConstan
 	timeout := url.GetParamDuration(constant.NacosTimeout, constant.DefaultRegTimeout)
 
 	clientConfig := nacosConstant.ClientConfig{
-		TimeoutMs:           uint64(int32(timeout / time.Millisecond)),
-		NamespaceId:         url.GetParam(constant.NacosNamespaceID, ""),
-		Username:            url.GetParam(constant.NacosUsername, ""),
-		Password:            url.GetParam(constant.NacosPassword, ""),
-		BeatInterval:        url.GetParamInt(constant.NacosBeatIntervalKey, 5000),
-		AppName:             url.GetParam(constant.NacosAppNameKey, ""),
-		Endpoint:            url.GetParam(constant.NacosEndpoint, ""),
-		RegionId:            url.GetParam(constant.NacosRegionIDKey, ""),
-		AccessKey:           url.GetParam(constant.NacosAccessKey, ""),
-		SecretKey:           url.GetParam(constant.NacosSecretKey, ""),
-		OpenKMS:             url.GetParamBool(constant.NacosOpenKmsKey, false),
-		CacheDir:            url.GetParam(constant.NacosCacheDirKey, ""),
-		UpdateThreadNum:     url.GetParamByIntValue(constant.NacosUpdateThreadNumKey, 20),
-		NotLoadCacheAtStart: url.GetParamBool(constant.NacosNotLoadLocalCache, true),
-		LogDir:              url.GetParam(constant.NacosLogDirKey, ""),
-		LogLevel:            url.GetParam(constant.NacosLogLevelKey, "info"),
+		TimeoutMs:            uint64(int32(timeout / time.Millisecond)),
+		NamespaceId:          url.GetParam(constant.NacosNamespaceID, ""),
+		Username:             url.GetParam(constant.NacosUsername, ""),
+		Password:             url.GetParam(constant.NacosPassword, ""),
+		BeatInterval:         url.GetParamInt(constant.NacosBeatIntervalKey, 5000),
+		AppName:              url.GetParam(constant.NacosAppNameKey, ""),
+		Endpoint:             url.GetParam(constant.NacosEndpoint, ""),
+		RegionId:             url.GetParam(constant.NacosRegionIDKey, ""),
+		AccessKey:            url.GetParam(constant.NacosAccessKey, ""),
+		SecretKey:            url.GetParam(constant.NacosSecretKey, ""),
+		OpenKMS:              url.GetParamBool(constant.NacosOpenKmsKey, false),
+		CacheDir:             url.GetParam(constant.NacosCacheDirKey, ""),
+		UpdateThreadNum:      url.GetParamByIntValue(constant.NacosUpdateThreadNumKey, 20),
+		NotLoadCacheAtStart:  url.GetParamBool(constant.NacosNotLoadLocalCache, true),
+		LogDir:               url.GetParam(constant.NacosLogDirKey, ""),
+		LogLevel:             url.GetParam(constant.NacosLogLevelKey, "info"),
+		UpdateCacheWhenEmpty: url.GetParamBool(constant.NacosUpdateCacheWhenEmpty, false),
 	}
 	return serverConfigs, clientConfig, nil
 }