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:
Michael Lumish 2019-10-10 14:18:29 -07:00 committed by GitHub
commit 607def892e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "0.6.7",
"version": "0.6.8",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -343,20 +343,27 @@ export class PickFirstLoadBalancer implements LoadBalancer {
lbConfig: LoadBalancingConfig | null
): void {
// 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.connectToAddressList();
}
}
exitIdle() {
for (const subchannel of this.subchannels) {
subchannel.startConnecting();
}
if (this.currentState === ConnectivityState.IDLE) {
this.channelControlHelper.requestReresolution();
if (this.latestAddressList.length > 0) {
this.connectToAddressList();
}
}
if (this.currentState === ConnectivityState.IDLE || this.triedAllSubchannels) {
this.channelControlHelper.requestReresolution();
}
}
resetBackoff() {