Don't update identical states with identical pickers

This commit is contained in:
Michael Lumish 2021-02-09 12:20:01 -08:00
parent c3c39af8ac
commit d1aa9aa6fc
1 changed files with 9 additions and 0 deletions

View File

@ -177,6 +177,8 @@ class XdsClusterManager implements LoadBalancer {
// End of XdsClusterManagerChildImpl
private children: Map<string, XdsClusterManagerChild> = new Map<string, XdsClusterManagerChild>();
// Shutdown is a placeholder value that will never appear in normal operation.
private currentState: ConnectivityState = ConnectivityState.SHUTDOWN;
constructor(private channelControlHelper: ChannelControlHelper) {}
private updateState() {
@ -208,6 +210,13 @@ class XdsClusterManager implements LoadBalancer {
} else {
connectivityState = ConnectivityState.TRANSIENT_FAILURE;
}
/* For each of the states CONNECTING, IDLE, and TRANSIENT_FAILURE, there is
* exactly one corresponding picker, so if the state is one of those and
* that does not change, no new information is provided by passing the
* new state upward. */
if (connectivityState === this.currentState && connectivityState !== ConnectivityState.READY) {
return;
}
let picker: Picker;
switch (connectivityState) {