Skip to content

Commit

Permalink
Merge pull request #200 from hufeng/v3.0.0
Browse files Browse the repository at this point in the history
remove _agentAddrSet
  • Loading branch information
hufeng committed Jan 11, 2020
2 parents 641346c + 3b711b3 commit a614527
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/dubbo/src/registry/zookeeper.ts
Expand Up @@ -31,7 +31,7 @@ import {
IDubboRegistryProps,
IZkClientProps,
} from '../types';
import {eqSet, isDevEnv, msg, traceErr} from '../util';
import {isDevEnv, msg, traceErr} from '../util';
import Registry from './registry';

const log = debug('dubbo:zookeeper');
Expand All @@ -44,15 +44,12 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
log(`new:|> %O`, props);
//默认dubbo
this._props.zkRoot = this._props.zkRoot || 'dubbo';
//初始化agentAddrSet
this._agentAddrSet = new Set();
//初始化zookeeper的client
this._connect(this._init);
}

private _checkTimer: NodeJS.Timer;
private _client: zookeeper.Client;
private _agentAddrSet: Set<string>;

//========================private method==========================
private _init = async (err: Error) => {
Expand Down Expand Up @@ -104,7 +101,6 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
log('dubboServiceUrl:|> %O', this._dubboServiceUrlMap);
}

this._agentAddrSet = this._allAgentAddrSet;
this._subscriber.onData(this._allAgentAddrSet);
};

Expand Down Expand Up @@ -281,12 +277,7 @@ export class ZkRegistry extends Registry<IZkClientProps & IDubboRegistryProps> {
);
}

if (!eqSet(this._agentAddrSet, this._allAgentAddrSet)) {
this._agentAddrSet = this._allAgentAddrSet;
this._subscriber.onData(this._allAgentAddrSet);
} else {
log('no agent change');
}
this._subscriber.onData(this._allAgentAddrSet);
};
}

Expand Down

0 comments on commit a614527

Please sign in to comment.