Skip to content

Commit

Permalink
pkg/cvo: Fix maxRetries comment (not about machineconfig pools)
Browse files Browse the repository at this point in the history
This seems to have been copy-pasted from the machine-config operator
in 6c8f725 (cvo: refactor to informers, 2018-08-14, #7) and then
from there over to the auto-update package with ad4bd6c (pkg: add
autoupdate ctrl, 2018-08-22, #11).  Update to generic wording that is
less likely to go stale.
  • Loading branch information
wking committed Aug 5, 2020
1 parent d2fc678 commit ae0b69b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions pkg/autoupdate/autoupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ import (
)

const (
// maxRetries is the number of times a machineconfig pool will be retried before it is dropped out of the queue.
// With the current rate-limiter in use (5ms*2^(maxRetries-1)) the following numbers represent the times
// a machineconfig pool is going to be requeued:
//
// 5ms, 10ms, 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1.3s, 2.6s, 5.1s, 10.2s, 20.4s, 41s, 82s
// maxRetries is the number of times a work-item be retried before it is dropped out of the queue.
maxRetries = 15
)

Expand Down Expand Up @@ -141,13 +137,13 @@ func (ctrl *Controller) handleErr(err error, key interface{}) {
}

if ctrl.queue.NumRequeues(key) < maxRetries {
klog.V(2).Infof("Error syncing controller %v: %v", key, err)
klog.V(2).Infof("Error handling %v: %v", key, err)
ctrl.queue.AddRateLimited(key)
return
}

utilruntime.HandleError(err)
klog.V(2).Infof("Dropping controller %q out of the queue: %v", key, err)
klog.V(2).Infof("Dropping %q out of the queue: %v", key, err)
ctrl.queue.Forget(key)
}

Expand Down
10 changes: 3 additions & 7 deletions pkg/cvo/cvo.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ import (
)

const (
// maxRetries is the number of times a machineconfig pool will be retried before it is dropped out of the queue.
// With the current rate-limiter in use (5ms*2^(maxRetries-1)) the following numbers represent the times
// a machineconfig pool is going to be requeued:
//
// 5ms, 10ms, 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1.3s, 2.6s, 5.1s, 10.2s, 20.4s, 41s, 82s
// maxRetries is the number of times a work-item be retried before it is dropped out of the queue.
maxRetries = 15
)

Expand Down Expand Up @@ -400,14 +396,14 @@ func handleErr(ctx context.Context, queue workqueue.RateLimitingInterface, err e
}

if queue.NumRequeues(key) < maxRetries {
klog.V(2).Infof("Error syncing operator %v: %v", key, err)
klog.V(2).Infof("Error handling %v: %v", key, err)
queue.AddRateLimited(key)
return
}

err = syncFailingStatus(ctx, nil, err)
utilruntime.HandleError(err)
klog.V(2).Infof("Dropping operator %q out of the queue %v: %v", key, queue, err)
klog.V(2).Infof("Dropping %q out of the queue %v: %v", key, queue, err)
queue.Forget(key)
}

Expand Down

0 comments on commit ae0b69b

Please sign in to comment.