Skip to content

Commit

Permalink
xds/clusterimpl: fix SubConn wrapper returned by picker during race (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Oct 15, 2021
1 parent 7e5fcc6 commit 3db1cb0
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions xds/internal/balancer/clusterimpl/picker.go
Expand Up @@ -102,17 +102,15 @@ func newPicker(s balancer.State, config *dropConfigs, loadStore load.PerClusterR
func (d *picker) Pick(info balancer.PickInfo) (balancer.PickResult, error) {
// Don't drop unless the inner picker is READY. Similar to
// https://github.com/grpc/grpc-go/issues/2622.
if d.s.ConnectivityState != connectivity.Ready {
return d.s.Picker.Pick(info)
}

// Check if this RPC should be dropped by category.
for _, dp := range d.drops {
if dp.drop() {
if d.loadStore != nil {
d.loadStore.CallDropped(dp.category)
if d.s.ConnectivityState == connectivity.Ready {
// Check if this RPC should be dropped by category.
for _, dp := range d.drops {
if dp.drop() {
if d.loadStore != nil {
d.loadStore.CallDropped(dp.category)
}
return balancer.PickResult{}, status.Errorf(codes.Unavailable, "RPC is dropped")
}
return balancer.PickResult{}, status.Errorf(codes.Unavailable, "RPC is dropped")
}
}

Expand Down

0 comments on commit 3db1cb0

Please sign in to comment.