Skip to content

Commit

Permalink
Fix nacos-client get config frequently when listen config use empty n…
Browse files Browse the repository at this point in the history
…amespace id.
  • Loading branch information
KomachiSion committed Nov 22, 2024
1 parent a1fb76f commit bf9fbde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.remote.request.RequestMeta;
import com.alibaba.nacos.auth.annotation.Secured;
import com.alibaba.nacos.common.utils.NamespaceUtil;
import com.alibaba.nacos.config.server.service.ConfigCacheService;
import com.alibaba.nacos.config.server.utils.GroupKey2;
import com.alibaba.nacos.config.server.utils.ParamUtils;
import com.alibaba.nacos.core.control.TpsControl;
import com.alibaba.nacos.core.paramcheck.ExtractorManager;
import com.alibaba.nacos.core.paramcheck.impl.ConfigBatchListenRequestParamExtractor;
import com.alibaba.nacos.core.remote.RequestHandler;
import com.alibaba.nacos.core.control.TpsControl;
import com.alibaba.nacos.core.utils.StringPool;
import com.alibaba.nacos.plugin.auth.constant.ActionTypes;
import com.alibaba.nacos.plugin.auth.constant.SignType;
Expand Down Expand Up @@ -59,8 +60,8 @@ public ConfigChangeBatchListenResponse handle(ConfigBatchListenRequest configCha
ParamUtils.checkParam(tag);
ConfigChangeBatchListenResponse configChangeBatchListenResponse = new ConfigChangeBatchListenResponse();
for (ConfigBatchListenRequest.ConfigListenContext listenContext : configChangeListenRequest.getConfigListenContexts()) {
String groupKey = GroupKey2.getKey(listenContext.getDataId(), listenContext.getGroup(),
listenContext.getTenant());
String namespaceId = NamespaceUtil.processNamespaceParameter(listenContext.getTenant());
String groupKey = GroupKey2.getKey(listenContext.getDataId(), listenContext.getGroup(), namespaceId);
groupKey = StringPool.get(groupKey);

String md5 = StringPool.get(listenContext.getMd5());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ private ConfigQueryResponse getContext(ConfigQueryRequest configQueryRequest, Re
String clientIp = meta.getClientIp();
String tag = configQueryRequest.getTag();

String groupKey = GroupKey2.getKey(configQueryRequest.getDataId(), configQueryRequest.getGroup(),
configQueryRequest.getTenant());
String groupKey = GroupKey2.getKey(configQueryRequest.getDataId(), configQueryRequest.getGroup(), tenant);
String requestIpApp = meta.getLabels().get(CLIENT_APPNAME_HEADER);
String acceptCharset = ENCODE_UTF8;
ParamUtils.checkParam(tag);
Expand Down

0 comments on commit bf9fbde

Please sign in to comment.