Skip to content

Commit

Permalink
chore: Update returned results on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Baarsgaard committed Jan 1, 2025
1 parent 69f253d commit cd2f1c5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions controllers/grafanafolder_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result,
var opts []client.ListOption
err := r.Client.List(ctx, grafanas, opts...)
if err != nil {
return ctrl.Result{
Requeue: true,
}, err
return ctrl.Result{}, err
}

// no instances, no need to sync
Expand All @@ -80,9 +78,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result,
allFolders := &grafanav1beta1.GrafanaFolderList{}
err = r.Client.List(ctx, allFolders, opts...)
if err != nil {
return ctrl.Result{
Requeue: true,
}, err
return ctrl.Result{}, err
}

// sync folders, delete folders from grafana that do no longer have a cr
Expand All @@ -100,7 +96,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result,
for grafana, existingFolders := range foldersToDelete {
grafanaClient, err := client2.NewGeneratedGrafanaClient(ctx, r.Client, grafana)
if err != nil {
return ctrl.Result{Requeue: true}, err
return ctrl.Result{}, err
}

for _, folder := range existingFolders {
Expand All @@ -121,7 +117,7 @@ func (r *GrafanaFolderReconciler) syncFolders(ctx context.Context) (ctrl.Result,
if errors.As(err, &notFound) {
r.Log.Info("folder no longer exists", "namespace", namespace, "name", name)
} else {
return ctrl.Result{Requeue: false}, err
return ctrl.Result{}, err
}
}

Expand Down

0 comments on commit cd2f1c5

Please sign in to comment.