@@ -213,8 +213,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
213
213
*/
214
214
private connectionDelayTimeout : NodeJS . Timeout ;
215
215
216
- private triedAllSubchannels = false ;
217
-
218
216
/**
219
217
* The LB policy enters sticky TRANSIENT_FAILURE mode when all
220
218
* subchannels have failed to connect at least once, and it stays in that
@@ -225,12 +223,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
225
223
226
224
private reportHealthStatus : boolean ;
227
225
228
- /**
229
- * Indicates whether we called channelControlHelper.requestReresolution since
230
- * the last call to updateAddressList
231
- */
232
- private requestedResolutionSinceLastUpdate = false ;
233
-
234
226
/**
235
227
* The most recent error reported by any subchannel as it transitioned to
236
228
* TRANSIENT_FAILURE.
@@ -259,6 +251,10 @@ export class PickFirstLoadBalancer implements LoadBalancer {
259
251
return this . children . every ( child => child . hasReportedTransientFailure ) ;
260
252
}
261
253
254
+ private resetChildrenReportedTF ( ) {
255
+ this . children . every ( child => child . hasReportedTransientFailure = false ) ;
256
+ }
257
+
262
258
private calculateAndReportNewState ( ) {
263
259
if ( this . currentPick ) {
264
260
if ( this . reportHealthStatus && ! this . currentPick . isHealthy ( ) ) {
@@ -291,23 +287,15 @@ export class PickFirstLoadBalancer implements LoadBalancer {
291
287
}
292
288
293
289
private requestReresolution ( ) {
294
- this . requestedResolutionSinceLastUpdate = true ;
295
290
this . channelControlHelper . requestReresolution ( ) ;
296
291
}
297
292
298
293
private maybeEnterStickyTransientFailureMode ( ) {
299
294
if ( ! this . allChildrenHaveReportedTF ( ) ) {
300
295
return ;
301
296
}
302
- if ( ! this . requestedResolutionSinceLastUpdate ) {
303
- /* Each time we get an update we reset each subchannel's
304
- * hasReportedTransientFailure flag, so the next time we get to this
305
- * point after that, each subchannel has reported TRANSIENT_FAILURE
306
- * at least once since then. That is the trigger for requesting
307
- * reresolution, whether or not the LB policy is already in sticky TF
308
- * mode. */
309
- this . requestReresolution ( ) ;
310
- }
297
+ this . requestReresolution ( ) ;
298
+ this . resetChildrenReportedTF ( ) ;
311
299
if ( this . stickyTransientFailureMode ) {
312
300
return ;
313
301
}
@@ -369,9 +357,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
369
357
370
358
private startNextSubchannelConnecting ( startIndex : number ) {
371
359
clearTimeout ( this . connectionDelayTimeout ) ;
372
- if ( this . triedAllSubchannels ) {
373
- return ;
374
- }
375
360
for ( const [ index , child ] of this . children . entries ( ) ) {
376
361
if ( index >= startIndex ) {
377
362
const subchannelState = child . subchannel . getConnectivityState ( ) ;
@@ -384,7 +369,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
384
369
}
385
370
}
386
371
}
387
- this . triedAllSubchannels = true ;
388
372
this . maybeEnterStickyTransientFailureMode ( ) ;
389
373
}
390
374
@@ -464,8 +448,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
464
448
}
465
449
this . currentSubchannelIndex = 0 ;
466
450
this . children = [ ] ;
467
- this . triedAllSubchannels = false ;
468
- this . requestedResolutionSinceLastUpdate = false ;
469
451
}
470
452
471
453
private connectToAddressList ( addressList : SubchannelAddress [ ] ) {
@@ -511,7 +493,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
511
493
if ( ! ( lbConfig instanceof PickFirstLoadBalancingConfig ) ) {
512
494
return ;
513
495
}
514
- this . requestedResolutionSinceLastUpdate = false ;
515
496
/* Previously, an update would be discarded if it was identical to the
516
497
* previous update, to minimize churn. Now the DNS resolver is
517
498
* rate-limited, so that is less of a concern. */
0 commit comments