Fix mutually exclusive verification for Redis
This commit is contained in:
parent
1d445d5c9d
commit
278d903bb4
1 changed files with 14 additions and 4 deletions
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue