From bd1e4faf063f335f0286a9795f3371a786bdf557 Mon Sep 17 00:00:00 2001 From: yangw Date: Tue, 21 May 2024 20:05:20 +0800 Subject: [PATCH] fix: check redis replication after handling finalizer (#936) Signed-off-by: drivebyer --- controllers/redissentinel_controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/redissentinel_controller.go b/controllers/redissentinel_controller.go index a3c4fe53c..f817abccb 100644 --- a/controllers/redissentinel_controller.go +++ b/controllers/redissentinel_controller.go @@ -45,11 +45,6 @@ func (r *RedisSentinelReconciler) Reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{RequeueAfter: time.Second * 10}, nil } - if instance.Spec.RedisSentinelConfig != nil && !k8sutils.IsRedisReplicationReady(ctx, reqLogger, r.K8sClient, r.Dk8sClient, instance) { - reqLogger.Info("Redis Replication is specified but not ready, so will reconcile again in 10 seconds") - return ctrl.Result{RequeueAfter: time.Second * 10}, nil - } - // Get total Sentinel Replicas // sentinelReplicas := instance.Spec.GetSentinelCounts("sentinel") @@ -61,6 +56,11 @@ func (r *RedisSentinelReconciler) Reconcile(ctx context.Context, req ctrl.Reques return ctrl.Result{RequeueAfter: time.Second * 60}, err } + if instance.Spec.RedisSentinelConfig != nil && !k8sutils.IsRedisReplicationReady(ctx, reqLogger, r.K8sClient, r.Dk8sClient, instance) { + reqLogger.Info("Redis Replication is specified but not ready, so will reconcile again in 10 seconds") + return ctrl.Result{RequeueAfter: time.Second * 10}, nil + } + // Create Redis Sentinel err = k8sutils.CreateRedisSentinel(ctx, r.K8sClient, r.Log, instance, r.K8sClient, r.Dk8sClient) if err != nil {