Skip to content

⚠️ Deprecate reconcile.Result.Requeue #3107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (c *Controller[request]) reconcileHandler(ctx context.Context, req request)
c.Queue.Forget(req)
c.Queue.AddAfter(req, result.RequeueAfter)
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeueAfter).Inc()
case result.Requeue:
case result.Requeue: //nolint: staticcheck // We have to handle it until it is removed
log.V(5).Info("Reconcile done, requeueing")
c.Queue.AddRateLimited(req)
ctrlmetrics.ReconcileTotal.WithLabelValues(c.Name, labelRequeue).Inc()
Expand Down
12 changes: 11 additions & 1 deletion pkg/reconcile/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ import (

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

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