From 99a37022bac0e633058f21e3af5ec3344f545126 Mon Sep 17 00:00:00 2001 From: yqylovy Date: Thu, 18 Jan 2018 14:38:25 +0800 Subject: [PATCH] hotfix:ignore more info in cluster --- parser.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/parser.go b/parser.go index 741c02a31..1b2e873d2 100644 --- a/parser.go +++ b/parser.go @@ -604,8 +604,8 @@ func clusterSlotInfoSliceParser(cn *conn, n int64) (interface{}, error) { if err != nil { return nil, err } - if n != 2 { - return nil, fmt.Errorf("got %d elements in cluster info address, expected 2", n) + if n < 2 { + return nil, fmt.Errorf("got %d elements in cluster info address, expected at least 2", n) } ip, err := readStringReply(cn) @@ -618,6 +618,16 @@ func clusterSlotInfoSliceParser(cn *conn, n int64) (interface{}, error) { return nil, err } + // IGNORE MSG + // FIX NEWER VERSION's ADDED INFO + // https://redis.io/commands/cluster-slots#Warnings + for i := int64(2); i < n; i++ { + _, err := readStringReply(cn) + if err != nil { + return nil, err + } + } + info.Addrs[i] = net.JoinHostPort(ip, strconv.FormatInt(port, 10)) }