mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
grpc-js: pick first: resolve address again after trying all addresses
This commit is contained in:
parent
56df09ceb0
commit
d5931ad232
@ -343,15 +343,20 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||
lbConfig: LoadBalancingConfig | null
|
||||
): void {
|
||||
// lbConfig has no useful information for pick first load balancing
|
||||
this.latestAddressList = addressList;
|
||||
this.connectToAddressList();
|
||||
/* 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) {
|
||||
if (this.currentState === ConnectivityState.IDLE || this.triedAllSubchannels) {
|
||||
this.channelControlHelper.requestReresolution();
|
||||
if (this.latestAddressList.length > 0) {
|
||||
this.connectToAddressList();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user