diff --git a/clients/config_client/config_client.go b/clients/config_client/config_client.go index 4f12b23e..54ee973e 100644 --- a/clients/config_client/config_client.go +++ b/clients/config_client/config_client.go @@ -247,6 +247,9 @@ func (client *ConfigClient) getConfigInner(param *vo.ConfigParam) (content strin logger.Warnf("read config from cache success, dataId=%s, group=%s, namespaceId=%s", param.DataId, param.Group, clientConfig.NamespaceId) return cacheContent, nil } + if response != nil && response.Response != nil && !response.IsSuccess() { + return response.Content, errors.New(response.GetMessage()) + } param.EncryptedDataKey = response.EncryptedDataKey param.Content = response.Content return response.Content, nil @@ -281,8 +284,11 @@ func (client *ConfigClient) PublishConfig(param vo.ConfigParam) (published bool, request.AdditionMap["encryptedDataKey"] = param.EncryptedDataKey rpcClient := client.configProxy.getRpcClient(client) response, err := client.configProxy.requestProxy(rpcClient, request, constant.DEFAULT_TIMEOUT_MILLS) + if err != nil { + return false, err + } if response != nil { - return response.IsSuccess(), err + return client.buildResponse(response) } return false, err } @@ -301,8 +307,11 @@ func (client *ConfigClient) DeleteConfig(param vo.ConfigParam) (deleted bool, er request := rpc_request.NewConfigRemoveRequest(param.Group, param.DataId, clientConfig.NamespaceId) rpcClient := client.configProxy.getRpcClient(client) response, err := client.configProxy.requestProxy(rpcClient, request, constant.DEFAULT_TIMEOUT_MILLS) + if err != nil { + return false, err + } if response != nil { - return response.IsSuccess(), err + return client.buildResponse(response) } return false, err } @@ -509,6 +518,11 @@ func (client *ConfigClient) refreshContentAndCheck(cacheData cacheData, notify b cacheData.group, cacheData.tenant) return } + if configQueryResponse != nil && configQueryResponse.Response != nil && !configQueryResponse.IsSuccess() { + logger.Errorf("refresh cached config from server error:%v, dataId=%s, group=%s", configQueryResponse.GetMessage(), + cacheData.dataId, cacheData.group) + return + } cacheData.content = configQueryResponse.Content cacheData.contentType = configQueryResponse.ContentType cacheData.encryptedDataKey = configQueryResponse.EncryptedDataKey @@ -551,3 +565,10 @@ func (client *ConfigClient) asyncNotifyListenConfig() { client.listenExecute <- struct{}{} }() } + +func (client *ConfigClient) buildResponse(response rpc_response.IResponse) (bool, error) { + if response.IsSuccess() { + return response.IsSuccess(), nil + } + return false, errors.New(response.GetMessage()) +} diff --git a/clients/naming_client/naming_client.go b/clients/naming_client/naming_client.go index 24f8b761..a2257e1a 100644 --- a/clients/naming_client/naming_client.go +++ b/clients/naming_client/naming_client.go @@ -265,6 +265,7 @@ func (sc *NamingClient) selectInstances(service model.Service, healthy bool) ([] } hosts := service.Hosts var result []model.Instance + logger.Infof("select instances with options: [healthy:<%s>], with service:<%s>", healthy, util.GetGroupName(service.Name, service.GroupName)) for _, host := range hosts { if host.Healthy == healthy && host.Enable && host.Weight > 0 { result = append(result, host)