Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-js: Add ChildLoadBalancerHandler and use it for refactoring #1406

Merged
merged 5 commits into from
May 27, 2020

Conversation

murgatroid99
Copy link
Member

@murgatroid99 murgatroid99 commented May 4, 2020

The ChildLoadBalancerHandler encapsulates the logic of taking a new LoadBalancingConfig that may be for a different load balancer type than the one currently in use, and performing the switchover when the new balancer becomes ready. The behavior should be identical to the corresponding core class. This allows that behavior to be factored out of the ResolvingLoadBalancer class, and it will also be used by future load balancer types like priority and weighted_target.

With that logic factored out of ResolvingLoadBalancer, the replaceChannelControlHelper method on the LoadBalancer type is no longer used anywhere, so it can be removed entirely, and the channelControlHelper constructor argument and private member can be made readonly for a stronger guarantee.

The LoadBalancingConfig type is modified to much more closely match the oneof type in the protobuf definition, and the name attribute makes it much easier to check which type a given LoadBalancingConfig is.

The priority load balancing config types are in here because this PR was originally adding that load balancer implementation and I didn't feel like extracting that from the rest of the changes to that file.

One thing to note: with this change, we no longer remove child load balancers that go IDLE. I think that is no longer necessary because I have since fixed the bugs with making those load balancers leave IDLE, and this change makes the logic simpler.

@murgatroid99 murgatroid99 requested a review from nicolasnoble May 4, 2020 21:15
@murgatroid99 murgatroid99 merged commit f309912 into grpc:master May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants