Skip to content

Commit

Permalink
fix handling replica info result
Browse files Browse the repository at this point in the history
  • Loading branch information
stlava committed May 7, 2024
1 parent 232af0a commit cc95230
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions rediscluster/slotrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,22 @@ func (s *shard) setReplicaInfo(res interface{}, n uint64) {
} else if n&1 == 0 {
str, ok := res.(string)
haserr = !(ok && str == "OK")
} else if buf, ok := res.([]byte); !ok {
}

var buf []byte
switch v := res.(type) {
case []byte:
buf = v
case redis.ByteResponse:
buf = v.Val
default:
haserr = true
} else if bytes.Contains(buf, []byte("master_link_status:down")) || bytes.Contains(buf, []byte("loading:1")) {
}

if bytes.Contains(buf, []byte("master_link_status:down")) || bytes.Contains(buf, []byte("loading:1")) {
haserr = true
}

for {
oldstate := atomic.LoadUint32(&s.good)
newstate := oldstate
Expand Down

0 comments on commit cc95230

Please sign in to comment.