@@ -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,15 @@ 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 . channelControlHelper . addChannelzChild ( subchannel . getChannelzRef ( ) ) ;
489
+ subchannel . addConnectivityStateListener ( this . subchannelStateListener ) ;
490
+ this . pickSubchannel ( subchannel ) ;
491
+ return ;
492
+ }
493
+ }
486
494
/* Ref each subchannel before resetting the list, to ensure that
487
495
* subchannels shared between the list don't drop to 0 refs during the
488
496
* transition. */
@@ -494,10 +502,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
494
502
this . children = newChildrenList ;
495
503
for ( const { subchannel } of this . children ) {
496
504
subchannel . addConnectivityStateListener ( this . subchannelStateListener ) ;
497
- if ( subchannel . getConnectivityState ( ) === ConnectivityState . READY ) {
498
- this . pickSubchannel ( subchannel ) ;
499
- return ;
500
- }
501
505
}
502
506
for ( const child of this . children ) {
503
507
if (
@@ -527,6 +531,7 @@ export class PickFirstLoadBalancer implements LoadBalancer {
527
531
const rawAddressList = ( [ ] as SubchannelAddress [ ] ) . concat (
528
532
...endpointList . map ( endpoint => endpoint . addresses )
529
533
) ;
534
+ trace ( 'updateAddressList([' + rawAddressList . map ( address => subchannelAddressToString ( address ) ) + '])' ) ;
530
535
if ( rawAddressList . length === 0 ) {
531
536
throw new Error ( 'No addresses in endpoint list passed to pick_first' ) ;
532
537
}
0 commit comments