@@ -70,9 +70,7 @@ type Reflector struct {
70
70
listerWatcher ListerWatcher
71
71
// backoff manages backoff of ListWatch
72
72
backoffManager wait.BackoffManager
73
- // initConnBackoffManager manages backoff the initial connection with the Watch call of ListAndWatch.
74
- initConnBackoffManager wait.BackoffManager
75
- resyncPeriod time.Duration
73
+ resyncPeriod time.Duration
76
74
// clock allows tests to manipulate time
77
75
clock clock.Clock
78
76
// paginatedResult defines whether pagination should be forced for list calls.
@@ -221,11 +219,10 @@ func NewReflectorWithOptions(lw ListerWatcher, expectedType interface{}, store S
221
219
// We used to make the call every 1sec (1 QPS), the goal here is to achieve ~98% traffic reduction when
222
220
// API server is not healthy. With these parameters, backoff will stop at [30,60) sec interval which is
223
221
// 0.22 QPS. If we don't backoff for 2min, assume API server is healthy and we reset the backoff.
224
- backoffManager : wait .NewExponentialBackoffManager (800 * time .Millisecond , 30 * time .Second , 2 * time .Minute , 2.0 , 1.0 , reflectorClock ),
225
- initConnBackoffManager : wait .NewExponentialBackoffManager (800 * time .Millisecond , 30 * time .Second , 2 * time .Minute , 2.0 , 1.0 , reflectorClock ),
226
- clock : reflectorClock ,
227
- watchErrorHandler : WatchErrorHandler (DefaultWatchErrorHandler ),
228
- expectedType : reflect .TypeOf (expectedType ),
222
+ backoffManager : wait .NewExponentialBackoffManager (800 * time .Millisecond , 30 * time .Second , 2 * time .Minute , 2.0 , 1.0 , reflectorClock ),
223
+ clock : reflectorClock ,
224
+ watchErrorHandler : WatchErrorHandler (DefaultWatchErrorHandler ),
225
+ expectedType : reflect .TypeOf (expectedType ),
229
226
}
230
227
231
228
if r .name == "" {
@@ -425,7 +422,7 @@ func (r *Reflector) watch(w watch.Interface, stopCh <-chan struct{}, resyncerrc
425
422
select {
426
423
case <- stopCh :
427
424
return nil
428
- case <- r .initConnBackoffManager .Backoff ().C ():
425
+ case <- r .backoffManager .Backoff ().C ():
429
426
continue
430
427
}
431
428
}
@@ -451,7 +448,7 @@ func (r *Reflector) watch(w watch.Interface, stopCh <-chan struct{}, resyncerrc
451
448
select {
452
449
case <- stopCh :
453
450
return nil
454
- case <- r .initConnBackoffManager .Backoff ().C ():
451
+ case <- r .backoffManager .Backoff ().C ():
455
452
continue
456
453
}
457
454
case apierrors .IsInternalError (err ) && retry .ShouldRetry ():
@@ -604,7 +601,7 @@ func (r *Reflector) watchList(stopCh <-chan struct{}) (watch.Interface, error) {
604
601
isErrorRetriableWithSideEffectsFn := func (err error ) bool {
605
602
if canRetry := isWatchErrorRetriable (err ); canRetry {
606
603
klog .V (2 ).Infof ("%s: watch-list of %v returned %v - backing off" , r .name , r .typeDescription , err )
607
- <- r .initConnBackoffManager .Backoff ().C ()
604
+ <- r .backoffManager .Backoff ().C ()
608
605
return true
609
606
}
610
607
if isExpiredError (err ) || isTooLargeResourceVersionError (err ) {
0 commit comments