@@ -32,7 +32,7 @@ import {
32
32
PickResultType ,
33
33
UnavailablePicker ,
34
34
} from './picker' ;
35
- import { Endpoint , SubchannelAddress } from './subchannel-address' ;
35
+ import { Endpoint , SubchannelAddress , subchannelAddressToString } from './subchannel-address' ;
36
36
import * as logging from './logging' ;
37
37
import { LogVerbosity } from './constants' ;
38
38
import {
@@ -348,7 +348,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
348
348
if ( newState !== ConnectivityState . READY ) {
349
349
this . removeCurrentPick ( ) ;
350
350
this . calculateAndReportNewState ( ) ;
351
- this . requestReresolution ( ) ;
352
351
}
353
352
return ;
354
353
}
@@ -483,6 +482,13 @@ export class PickFirstLoadBalancer implements LoadBalancer {
483
482
subchannel : this . channelControlHelper . createSubchannel ( address , { } ) ,
484
483
hasReportedTransientFailure : false ,
485
484
} ) ) ;
485
+ trace ( 'connectToAddressList([' + addressList . map ( address => subchannelAddressToString ( address ) ) + '])' ) ;
486
+ for ( const { subchannel } of newChildrenList ) {
487
+ if ( subchannel . getConnectivityState ( ) === ConnectivityState . READY ) {
488
+ this . pickSubchannel ( subchannel ) ;
489
+ return ;
490
+ }
491
+ }
486
492
/* Ref each subchannel before resetting the list, to ensure that
487
493
* subchannels shared between the list don't drop to 0 refs during the
488
494
* transition. */
@@ -527,6 +533,7 @@ export class PickFirstLoadBalancer implements LoadBalancer {
527
533
const rawAddressList = ( [ ] as SubchannelAddress [ ] ) . concat (
528
534
...endpointList . map ( endpoint => endpoint . addresses )
529
535
) ;
536
+ trace ( 'updateAddressList([' + rawAddressList . map ( address => subchannelAddressToString ( address ) ) + '])' ) ;
530
537
if ( rawAddressList . length === 0 ) {
531
538
throw new Error ( 'No addresses in endpoint list passed to pick_first' ) ;
532
539
}
0 commit comments