Skip to content
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

No need to requeue in the broker controller reconcile loop #588

Closed
jxs1211 opened this issue Jan 21, 2025 · 2 comments
Closed

No need to requeue in the broker controller reconcile loop #588

jxs1211 opened this issue Jan 21, 2025 · 2 comments
Labels
issue/stale Issue has not had any activity for an extended period of time kind/bug Something isn't working

Comments

@jxs1211
Copy link

jxs1211 commented Jan 21, 2025

Current Behavior

If the resource is created successfully, it's not necessary to requeue the request in the broker controller loop.

Expected Behavior

Continue to create objects if each object is created successfully, the reconcile loop will be more efficient.

Screenshots/Logs

func (r *BrokerReconciler) reconcileBroker(ctx context.Context, enable bool, baseResource *mesheryv1alpha1.Broker, req ctrl.Request) (ctrl.Result, error) {
	objects := brokerpackage.GetObjects(baseResource)
	for _, object := range objects {
		object.SetNamespace(baseResource.Namespace)
		err := r.Get(ctx,
			types.NamespacedName{
				Name:      object.GetName(),
				Namespace: object.GetNamespace(),
			},
			object,
		)
		if err != nil && kubeerror.IsNotFound(err) && enable {
			_ = ctrl.SetControllerReference(baseResource, object, r.Scheme)
			er := r.Create(ctx, object)
			if er != nil {
				return ctrl.Result{}, ErrCreateMeshsync(er)
			}
			// do not requeue here because it's not necessary
			return ctrl.Result{Requeue: true}, nil

Environment

  • Host OS: Mac Linux Windows
  • Platform: Docker or Kubernetes

Contributor Guides and Resources

@jxs1211 jxs1211 added the kind/bug Something isn't working label Jan 21, 2025
@jxs1211 jxs1211 changed the title No need to requeue n the broker controller reconcile loop No need to requeue in the broker controller reconcile loop Jan 21, 2025
Copy link

stale bot commented Mar 7, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label Mar 7, 2025
Copy link

stale bot commented Mar 18, 2025

This issue is being automatically closed due to inactivity. However, you may choose to reopen this issue.

@stale stale bot closed this as completed Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/stale Issue has not had any activity for an extended period of time kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant