Skip to content

Commit

Permalink
fix: refresh cluster topology with CLUSTER SLOTS instead of `CLUSTE…
Browse files Browse the repository at this point in the history
…R SHARDS` for clusters which version < 8 due to the server bug.

Signed-off-by: Rueian <[email protected]>
  • Loading branch information
rueian committed Nov 7, 2024
1 parent bf8de44 commit fdb9a54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type clusterslots struct {
}

func (s clusterslots) parse(tls bool) map[string]group {
if s.ver < 7 {
if s.ver < 8 {
return parseSlots(s.reply.val, s.addr)
}
return parseShards(s.reply.val, s.addr, tls)
Expand All @@ -147,7 +147,7 @@ func getClusterSlots(c conn, timeout time.Duration) clusterslots {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
v := c.Version()
if v < 7 {
if v < 8 {
return clusterslots{reply: c.Do(ctx, cmds.SlotCmd), addr: c.Addr(), ver: v}
}
return clusterslots{reply: c.Do(ctx, cmds.ShardsCmd), addr: c.Addr(), ver: v}
Expand Down

0 comments on commit fdb9a54

Please sign in to comment.