diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 6fe687fa38d1b..3e4788e279004 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -486,12 +486,6 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() { found_subchannel->ReactToConnectivityStateLocked(); break; } - // If the first subchannel is already IDLE, trigger the right - // behavior immediately. - if (subchannel_list()->subchannel(0)->connectivity_state() == - GRPC_CHANNEL_IDLE) { - subchannel_list()->subchannel(0)->ReactToConnectivityStateLocked(); - } // We didn't find another subchannel not in state TRANSIENT_FAILURE, // so report TRANSIENT_FAILURE and wait for the first subchannel // in the list to report IDLE before continuing. @@ -528,6 +522,13 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() { p->UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status, MakeRefCounted(status)); } + // If the first subchannel is already IDLE, trigger the next connection + // attempt immediately. Otherwise, we'll wait for it to report + // its own connectivity state change. + auto* subchannel0 = subchannel_list()->subchannel(0); + if (subchannel0->connectivity_state() == GRPC_CHANNEL_IDLE) { + subchannel0->subchannel()->RequestConnection(); + } break; } case GRPC_CHANNEL_IDLE: