Skip to content

Commit

Permalink
fix: vectorstore retry too quickly
Browse files Browse the repository at this point in the history
Signed-off-by: Abirdcfly <[email protected]>
  • Loading branch information
Abirdcfly committed Dec 27, 2023
1 parent c8a8a3a commit ee62388
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/vectorstore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

arcadiav1alpha1 "github.com/kubeagi/arcadia/api/base/v1alpha1"
Expand Down Expand Up @@ -74,7 +76,7 @@ func (r *VectorStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, err
}
log.Info("Adding Finalizer for VectorStore done")
return ctrl.Result{}, nil
return ctrl.Result{Requeue: true}, nil
}

// Check if the VectorStore instance is marked to be deleted, which is
Expand Down Expand Up @@ -103,7 +105,7 @@ func (r *VectorStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}

if err := r.CheckVectorStore(ctx, log, vs); err != nil {
return reconcile.Result{RequeueAfter: waitMedium}, err
return reconcile.Result{RequeueAfter: waitMedium}, nil
}

return ctrl.Result{RequeueAfter: waitLonger}, nil
Expand All @@ -112,7 +114,8 @@ func (r *VectorStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request)
// SetupWithManager sets up the controller with the Manager.
func (r *VectorStoreReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&arcadiav1alpha1.VectorStore{}).
For(&arcadiav1alpha1.VectorStore{},
builder.WithPredicates(predicate.GenerationChangedPredicate{})).
Complete(r)
}

Expand Down

0 comments on commit ee62388

Please sign in to comment.