From 278d903bb4c10d2ba0a0929af70149ec3a6e4e83 Mon Sep 17 00:00:00 2001 From: Julien Salleyron Date: Mon, 22 Dec 2025 16:58:04 +0100 Subject: [PATCH] Fix mutually exclusive verification for Redis --- pkg/provider/kv/redis/redis.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/provider/kv/redis/redis.go b/pkg/provider/kv/redis/redis.go index c6e357f03..930cf087d 100644 --- a/pkg/provider/kv/redis/redis.go +++ b/pkg/provider/kv/redis/redis.go @@ -60,10 +60,20 @@ func (p *Provider) Init() error { } if p.Sentinel != nil { - switch { - case p.Sentinel.LatencyStrategy && !(p.Sentinel.RandomStrategy || p.Sentinel.ReplicaStrategy): - case p.Sentinel.RandomStrategy && !(p.Sentinel.LatencyStrategy || p.Sentinel.ReplicaStrategy): - case p.Sentinel.ReplicaStrategy && !(p.Sentinel.RandomStrategy || p.Sentinel.LatencyStrategy): + count := 0 + if p.Sentinel.LatencyStrategy { + count++ + } + + if p.Sentinel.ReplicaStrategy { + count++ + } + + if p.Sentinel.RandomStrategy { + count++ + } + + if count > 1 { return errors.New("latencyStrategy, randomStrategy and replicaStrategy options are mutually exclusive, please use only one of those options") }