mirror of https://github.com/grpc/grpc-node.git
Merge pull request #1072 from murgatroid99/grpc-js_pick_first_reresolve
grpc-js: pick first: resolve address again after trying all addresses
This commit is contained in:
commit
607def892e
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/grpc-js",
|
"name": "@grpc/grpc-js",
|
||||||
"version": "0.6.7",
|
"version": "0.6.8",
|
||||||
"description": "gRPC Library for Node - pure JS implementation",
|
"description": "gRPC Library for Node - pure JS implementation",
|
||||||
"homepage": "https://grpc.io/",
|
"homepage": "https://grpc.io/",
|
||||||
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
||||||
|
|
|
@ -343,20 +343,27 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
lbConfig: LoadBalancingConfig | null
|
lbConfig: LoadBalancingConfig | null
|
||||||
): void {
|
): void {
|
||||||
// lbConfig has no useful information for pick first load balancing
|
// lbConfig has no useful information for pick first load balancing
|
||||||
|
/* To avoid unnecessary churn, we only do something with this address list
|
||||||
|
* if we're not currently trying to establish a connection, or if the new
|
||||||
|
* address list is different from the existing one */
|
||||||
|
if (this.subchannels.length === 0 || !this.latestAddressList.every((value, index) => addressList[index] === value)) {
|
||||||
this.latestAddressList = addressList;
|
this.latestAddressList = addressList;
|
||||||
this.connectToAddressList();
|
this.connectToAddressList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exitIdle() {
|
exitIdle() {
|
||||||
for (const subchannel of this.subchannels) {
|
for (const subchannel of this.subchannels) {
|
||||||
subchannel.startConnecting();
|
subchannel.startConnecting();
|
||||||
}
|
}
|
||||||
if (this.currentState === ConnectivityState.IDLE) {
|
if (this.currentState === ConnectivityState.IDLE) {
|
||||||
this.channelControlHelper.requestReresolution();
|
|
||||||
if (this.latestAddressList.length > 0) {
|
if (this.latestAddressList.length > 0) {
|
||||||
this.connectToAddressList();
|
this.connectToAddressList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.currentState === ConnectivityState.IDLE || this.triedAllSubchannels) {
|
||||||
|
this.channelControlHelper.requestReresolution();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetBackoff() {
|
resetBackoff() {
|
||||||
|
|
Loading…
Reference in New Issue