Skip to content

Commit ee35e38

Browse files
alvaroalemangodwinpang
authored andcommitted
⚠️ Deprecate reconcile.Result.Requeue
There is no good reason to use this setting, either an error or `RequeueAfter` should be used instead. Deprecate it to avoid confusion.
1 parent e0dc36c commit ee35e38

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/internal/controller/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func (c *Controller[request]) reconcileHandler(ctx context.Context, req request,
354354
c.Queue.Forget(req)
355355
c.Queue.AddWithOpts(priorityqueue.AddOpts{After: result.RequeueAfter, Priority: priority}, req)
356356
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeueAfter).Inc()
357-
case result.Requeue:
357+
case result.Requeue: //nolint: staticcheck // We have to handle it until it is removed
358358
log.V(5).Info("Reconcile done, requeueing")
359359
c.Queue.AddWithOpts(priorityqueue.AddOpts{RateLimited: true, Priority: priority}, req)
360360
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeue).Inc()

pkg/reconcile/reconcile.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ import (
2828

2929
// Result contains the result of a Reconciler invocation.
3030
type Result struct {
31-
// Requeue tells the Controller to requeue the reconcile key. Defaults to false.
31+
// Requeue tells the Controller to perform a ratelimited requeue
32+
// using the workqueues ratelimiter. Defaults to false.
33+
//
34+
// This setting is deprecated as it causes confusion and there is
35+
// no good reason to use it. When waiting for an external event to
36+
// happen, either the duration until it is supposed to happen or an
37+
// appropriate poll interval should be used, rather than an
38+
// interval emitted by a ratelimiter whose purpose it is to control
39+
// retry on error.
40+
//
41+
// Deprecated: Use `RequeueAfter` instead.
3242
Requeue bool
3343

3444
// RequeueAfter if greater than 0, tells the Controller to requeue the reconcile key after the Duration.

0 commit comments

Comments
 (0)