Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复重连不应该清空已有的provider #157

Merged
merged 3 commits into from Nov 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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