Skip to content

Commit

Permalink
add nacos updateCacheWhenEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin0325 committed Apr 20, 2022
1 parent 759a9b5 commit 73451bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
1 change: 1 addition & 0 deletions common/constant/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ const (
NacosUsername = "nacos.username"
NacosPassword = "nacos.password"
NacosTimeout = "nacos.timeout"
UpdateCacheWhenEmpty = "nacos.updateCacheWhenEmpty"
)

const (
Expand Down
33 changes: 17 additions & 16 deletions remoting/nacos/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.UpdateCacheWhenEmpty, false),
}
return serverConfigs, clientConfig, nil
}
Expand Down

0 comments on commit 73451bc

Please sign in to comment.