Skip to content

Commit

Permalink
Merge pull request #157 from binlaniua/master
Browse files Browse the repository at this point in the history
修复重连不应该清空已有的provider
  • Loading branch information
hufeng committed Nov 15, 2019
2 parents 1a494c1 + f465100 commit 1a0a5ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/dubbo/src/registry/zookeeper.ts
Expand Up @@ -74,7 +74,9 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
//获取所有provider
for (let inf of interfaces) {
//init
this._dubboServiceUrlMap.set(inf, []);
// 重连进入init后不能清空已有provider, 会导致运行中的请求找到, 报no agents错误
// 或者zk出现出错了, 无法获取provider, 那么之前获取的还能继续使用
//this._dubboServiceUrlMap.set(inf, []);

//当前接口在zookeeper中的路径
const dubboServicePath = `/${zkRoot}/${inf}/providers`;
Expand All @@ -90,10 +92,8 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
continue;
}

for (let serviceUrl of dubboServiceUrls) {
const url = DubboUrl.from(serviceUrl);
this._dubboServiceUrlMap.get(inf).push(url);
}
this._dubboServiceUrlMap.set(inf, dubboServiceUrls.map(serviceUrl => DubboUrl.from(serviceUrl)));

//写入consumer信息
this._createConsumer({
name: name,
Expand Down

0 comments on commit 1a0a5ec

Please sign in to comment.