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

remove dumplicate consumer url #96

Merged
merged 1 commit into from Apr 29, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions packages/dubbo/src/types.ts
Expand Up @@ -158,9 +158,6 @@ export interface IQueryObj {
export type TQueueObserver = Function;

export interface ICreateConsumerParam {
host: string;
port: number;
name: string;
dubboInterface: string;
dubboVersion: string;
}
36 changes: 13 additions & 23 deletions packages/dubbo/src/zookeeper.ts
Expand Up @@ -151,18 +151,13 @@ export class ZkRegistry implements IObservable<IRegistrySubscriber> {

for (let serviceUrl of dubboServiceUrls) {
const url = DubboUrl.from(serviceUrl);
const {host, port, dubboVersion} = url;
this._dubboServiceUrlMap.get(inf).push(url);

//写入consume信息
this._createConsumer({
host: host,
port: port,
name: name,
dubboInterface: inf,
dubboVersion: dubboVersion,
}).then(() => log('create Consumer finish'));
}
//写入consumer信息
this._createConsumer({
name: name,
dubboInterface: inf,
}).then(() => log('create Consumer finish'));
}

if (isDevEnv) {
Expand Down Expand Up @@ -318,18 +313,16 @@ export class ZkRegistry implements IObservable<IRegistrySubscriber> {
const urls = [];
for (let serviceUrl of dubboServiceUrls) {
const url = DubboUrl.from(serviceUrl);
const {host, port, dubboVersion} = url;
const {host, port} = url;
agentAddrList.push(`${host}:${port}`);
urls.push(url);

this._createConsumer({
host: host,
port: port,
name: this._props.application.name,
dubboInterface: dubboInterface,
dubboVersion: dubboVersion,
}).then(() => log('create consumer finish'));
}

this._createConsumer({
name: this._props.application.name,
dubboInterface: dubboInterface,
}).then(() => log('create consumer finish'));

this._dubboServiceUrlMap.set(dubboInterface, urls);

if (agentAddrList.length === 0) {
Expand Down Expand Up @@ -382,7 +375,7 @@ export class ZkRegistry implements IObservable<IRegistrySubscriber> {
* com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry
*/
private async _createConsumer(params: ICreateConsumerParam) {
let {host, port, name, dubboInterface, dubboVersion} = params;
let {name, dubboInterface} = params;

const dubboSetting = this._props.dubboSetting.getDubboSetting(
dubboInterface,
Expand All @@ -395,12 +388,9 @@ export class ZkRegistry implements IObservable<IRegistrySubscriber> {
}

const queryParams = {
host,
port,
interface: dubboInterface,
application: name,
category: 'consumers',
dubbo: dubboVersion,
method: '',
revision: '',
version: dubboSetting.version,
Expand Down