Skip to content

Commit

Permalink
make code better and make ci pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff.wang committed Feb 1, 2023
1 parent c9fc5bd commit 77ed42b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions clients/config_client/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ func (client *ConfigClient) getConfigInner(param vo.ConfigParam) (content string
clientConfig.TimeoutMs, false, client)
if err != nil {
logger.Infof("get config from server error:%+v ", err)
if clientConfig, err := client.GetClientConfig(); err == nil {
if clientConfig.DisableUseSnapShot {
logger.Errorf("get config from cache error:%+v ", err)
return "", errors.New("get config from remote nacos server fail, and is not allowed to read local file")
}
if clientConfig, err := client.GetClientConfig(); err == nil && clientConfig.DisableUseSnapShot {
logger.Errorf("get config from cache error:%+v ", err)
return "", errors.New("get config from remote nacos server fail, and is not allowed to read local file")
}
content, err = cache.ReadConfigFromFile(cacheKey, client.configCacheDir)
if err != nil {
Expand Down Expand Up @@ -429,12 +427,12 @@ func (client *ConfigClient) executeConfigListen() {
logger.Warnf("ConfigBatchListenRequest failure,err:%+v", err)
continue
}
if !iResponse.IsSuccess() {
logger.Warnf("ConfigBatchListenRequest failure, error code:%+v", iResponse.GetErrorCode())
if iResponse == nil {
logger.Warnf("ConfigBatchListenRequest failure, response is nil")
continue
}

if iResponse == nil && !iResponse.IsSuccess() {
if !iResponse.IsSuccess() {
logger.Warnf("ConfigBatchListenRequest failure, error code:%+v", iResponse.GetErrorCode())
continue
}
changeKeys := make(map[string]struct{})
Expand Down
2 changes: 1 addition & 1 deletion common/security/security_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (ac *AuthClient) login(server constant.ServerConfig) (bool, error) {

if val, ok := result[constant.KEY_ACCESS_TOKEN]; ok {
ac.accessToken.Store(val)
ac.lastRefreshTime = time.Now().UnixMilli()
ac.lastRefreshTime = time.Now().Unix()
ac.tokenTtl = int64(result[constant.KEY_TOKEN_TTL].(float64))
ac.tokenRefreshWindow = ac.tokenTtl / 10
}
Expand Down

0 comments on commit 77ed42b

Please sign in to comment.