@grpc/grpc-js
Advanced tools
Comparing version 1.9.10 to 1.9.11
@@ -66,2 +66,3 @@ import { LoadBalancer, ChannelControlHelper, LoadBalancingConfig } from './load-balancer'; | ||
private lastError; | ||
private latestAddressList; | ||
/** | ||
@@ -90,2 +91,3 @@ * Load balancer that attempts to connect to each backend in the address list | ||
private resetSubchannelList; | ||
private connectToAddressList; | ||
updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig): void; | ||
@@ -92,0 +94,0 @@ exitIdle(): void; |
@@ -151,2 +151,3 @@ "use strict"; | ||
this.lastError = null; | ||
this.latestAddressList = null; | ||
this.connectionDelayTimeout = setTimeout(() => { }, 0); | ||
@@ -327,12 +328,3 @@ clearTimeout(this.connectionDelayTimeout); | ||
} | ||
updateAddressList(addressList, lbConfig) { | ||
if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) { | ||
return; | ||
} | ||
/* Previously, an update would be discarded if it was identical to the | ||
* previous update, to minimize churn. Now the DNS resolver is | ||
* rate-limited, so that is less of a concern. */ | ||
if (lbConfig.getShuffleAddressList()) { | ||
addressList = shuffled(addressList); | ||
} | ||
connectToAddressList(addressList) { | ||
const newChildrenList = addressList.map(address => ({ | ||
@@ -367,6 +359,19 @@ subchannel: this.channelControlHelper.createSubchannel(address, {}), | ||
} | ||
updateAddressList(addressList, lbConfig) { | ||
if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) { | ||
return; | ||
} | ||
/* Previously, an update would be discarded if it was identical to the | ||
* previous update, to minimize churn. Now the DNS resolver is | ||
* rate-limited, so that is less of a concern. */ | ||
if (lbConfig.getShuffleAddressList()) { | ||
addressList = shuffled(addressList); | ||
} | ||
this.latestAddressList = addressList; | ||
this.connectToAddressList(addressList); | ||
} | ||
exitIdle() { | ||
/* The pick_first LB policy is only in the IDLE state if it has no | ||
* addresses to try to connect to and it has no picked subchannel. | ||
* In that case, there is no meaningful action that can be taken here. */ | ||
if (this.currentState === connectivity_state_1.ConnectivityState.IDLE && this.latestAddressList) { | ||
this.connectToAddressList(this.latestAddressList); | ||
} | ||
} | ||
@@ -373,0 +378,0 @@ resetBackoff() { |
@@ -24,2 +24,3 @@ "use strict"; | ||
this.addresses = []; | ||
this.hasReturnedResult = false; | ||
let path; | ||
@@ -35,3 +36,6 @@ if (target.authority === '') { | ||
updateResolution() { | ||
process.nextTick(this.listener.onSuccessfulResolution, this.addresses, null, null, null, {}); | ||
if (!this.hasReturnedResult) { | ||
this.hasReturnedResult = true; | ||
process.nextTick(this.listener.onSuccessfulResolution, this.addresses, null, null, null, {}); | ||
} | ||
} | ||
@@ -38,0 +42,0 @@ destroy() { |
{ | ||
"name": "@grpc/grpc-js", | ||
"version": "1.9.10", | ||
"version": "1.9.11", | ||
"description": "gRPC Library for Node - pure JS implementation", | ||
@@ -5,0 +5,0 @@ "homepage": "https://grpc.io/", |
@@ -189,2 +189,4 @@ /* | ||
private latestAddressList: SubchannelAddress[] | null = null; | ||
/** | ||
@@ -408,15 +410,3 @@ * Load balancer that attempts to connect to each backend in the address list | ||
updateAddressList( | ||
addressList: SubchannelAddress[], | ||
lbConfig: LoadBalancingConfig | ||
): void { | ||
if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) { | ||
return; | ||
} | ||
/* Previously, an update would be discarded if it was identical to the | ||
* previous update, to minimize churn. Now the DNS resolver is | ||
* rate-limited, so that is less of a concern. */ | ||
if (lbConfig.getShuffleAddressList()) { | ||
addressList = shuffled(addressList); | ||
} | ||
private connectToAddressList(addressList: SubchannelAddress[]) { | ||
const newChildrenList = addressList.map(address => ({ | ||
@@ -454,6 +444,23 @@ subchannel: this.channelControlHelper.createSubchannel(address, {}), | ||
updateAddressList( | ||
addressList: SubchannelAddress[], | ||
lbConfig: LoadBalancingConfig | ||
): void { | ||
if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) { | ||
return; | ||
} | ||
/* Previously, an update would be discarded if it was identical to the | ||
* previous update, to minimize churn. Now the DNS resolver is | ||
* rate-limited, so that is less of a concern. */ | ||
if (lbConfig.getShuffleAddressList()) { | ||
addressList = shuffled(addressList); | ||
} | ||
this.latestAddressList = addressList; | ||
this.connectToAddressList(addressList); | ||
} | ||
exitIdle() { | ||
/* The pick_first LB policy is only in the IDLE state if it has no | ||
* addresses to try to connect to and it has no picked subchannel. | ||
* In that case, there is no meaningful action that can be taken here. */ | ||
if (this.currentState === ConnectivityState.IDLE && this.latestAddressList) { | ||
this.connectToAddressList(this.latestAddressList); | ||
} | ||
} | ||
@@ -460,0 +467,0 @@ |
@@ -24,2 +24,3 @@ /* | ||
private addresses: SubchannelAddress[] = []; | ||
private hasReturnedResult = false; | ||
constructor( | ||
@@ -39,10 +40,13 @@ target: GrpcUri, | ||
updateResolution(): void { | ||
process.nextTick( | ||
this.listener.onSuccessfulResolution, | ||
this.addresses, | ||
null, | ||
null, | ||
null, | ||
{} | ||
); | ||
if (!this.hasReturnedResult) { | ||
this.hasReturnedResult = true; | ||
process.nextTick( | ||
this.listener.onSuccessfulResolution, | ||
this.addresses, | ||
null, | ||
null, | ||
null, | ||
{} | ||
); | ||
} | ||
} | ||
@@ -49,0 +53,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1672289
34606