Skip to content

Commit

Permalink
Node controller now retries properly
Browse files Browse the repository at this point in the history
  • Loading branch information
njtran committed Sep 8, 2021
1 parent 751cca1 commit 5c8e002
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/node/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reco
if errs != nil {
return result.RetryIfError(ctx, errs)
}
return reconcile.Result{RequeueAfter: functional.MaxDuration(backoffs...)}, nil
return reconcile.Result{RequeueAfter: functional.MinDuration(backoffs...)}, nil
}

func (c *Controller) Register(ctx context.Context, m manager.Manager) error {
Expand Down
10 changes: 5 additions & 5 deletions pkg/utils/functional/functional.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ func InvertStringMap(stringMap map[string]string) map[string]string {
}

// MaxDuration returns the largest duration
func MaxDuration(durations ...time.Duration) time.Duration {
var max time.Duration
func MinDuration(durations ...time.Duration) time.Duration {
var min time.Duration
for _, duration := range durations {
if duration > max {
max = duration
if (duration < min && duration != 0) || (duration != 0 && min == 0) {
min = duration
}
}
return max
return min
}

0 comments on commit 5c8e002

Please sign in to comment.