<p>We have a kubernetes cluster, where a reconcile is triggered in response to a custom event.
Implemented in Golang using the following format:</p>
<pre><code>type reconciler struct {}

func (reconciler) Reconcile(ctx context.Context, o reconcile.Request) (reconcile.Result, error) {
    // Implement business logic of reading and writing objects here
    return reconcile.Result{}, nil
}
</code></pre>
<p>We have identified possible bottlenecks in the reconcile logic when the custom events are too many. So, the code has been updated to have a non-blocking reconcile logic.
Example:</p>
<pre><code>type reconciler struct {}

func (reconciler) Reconcile(ctx context.Context, o reconcile.Request) (reconcile.Result, error) {
    go func() {
        // Implement business logic of reading and writing objects here
    }()
    return reconcile.Result{}, nil
}
</code></pre>
<p>However, there are some places where the non-blocking go routine may return
<code>return ctrl.Result{Requeue: true}, nil</code>
or
<code>return ctrl.Result{RequeueAfter: someTime}, nil</code></p>
<p>How could we requeue such events to the reconcile loop in such scenarios, since the return would not return to the caller Reconcile()</p>

<p>I think a better approach would be to use concurrent reconciles allowing other requests to be handled while a single reconcile request is slow to handle. This way the reconcile request queue won't be blocked, and idle go routines are fairly cheap so it should not affect your performance all that much.</p>
<p>Check out the <code>MaxConcurrentReconciles</code> in <code>controller-runtime</code>:
<a href="https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/controller" rel="nofollow noreferrer">https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/controller</a></p>
