You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by me...@apache.org on 2019/11/19 07:32:02 UTC

[dubbo] branch 2.6.x updated: 修复nacos默认设置weight=1.0,导致权重获取bug (#5144)

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

mercyblitz pushed a commit to branch 2.6.x
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/2.6.x by this push:
     new 7797074  修复nacos默认设置weight=1.0,导致权重获取bug (#5144)
7797074 is described below

commit 77970748f2ed858ee36c7761ede904d0a26dba7d
Author: bruce <84...@qq.com>
AuthorDate: Tue Nov 19 15:31:55 2019 +0800

    修复nacos默认设置weight=1.0,导致权重获取bug (#5144)
---
 .../src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java    | 1 +
 .../main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java
index 20ce09a..06fced8 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java
@@ -433,6 +433,7 @@ public class NacosRegistry extends FailbackRegistry {
         Instance instance = new Instance();
         instance.setIp(ip);
         instance.setPort(port);
+        instance.setWeight(newURL.getParameter(Constants.WEIGHT_KEY, Constants.DEFAULT_WEIGHT));
         instance.setMetadata(new HashMap<String, String>(newURL.getParameters()));
         return instance;
     }
diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java
index 56de760..6bc26cf 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistryFactory.java
@@ -93,7 +93,6 @@ public class NacosRegistryFactory extends AbstractRegistryFactory {
         putPropertyIfAbsent(url, properties, NAMESPACE);
         putPropertyIfAbsent(url, properties, NACOS_NAMING_LOG_NAME);
         putPropertyIfAbsent(url, properties, ENDPOINT);
-        putPropertyIfAbsent(url, properties, NAMESPACE);
         putPropertyIfAbsent(url, properties, ACCESS_KEY);
         putPropertyIfAbsent(url, properties, SECRET_KEY);
         putPropertyIfAbsent(url, properties, CLUSTER_NAME);