Created
April 18, 2019 19:40
-
-
Save jameshartig/a1e255cbe0a64e99fa1dccc8a2ec485c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var c radix.Client | |
var raw resp2.RawMessage | |
err = conn.Do(radix.Cmd(&raw, "CLUSTER", "SLOTS")) | |
if err == nil { | |
var ct radix.ClusterTopo | |
var rerr resp2.Error | |
if ct.UnmarshalRESP(bufio.NewReaderSize(bytes.NewReader(raw), len(raw))) == nil { | |
c, err = radix.NewCluster([]string{ar.Addr}, | |
radix.ClusterPoolFunc(df), | |
) | |
} else if uerr := rerr.UnmarshalRESP(bufio.NewReaderSize(bytes.NewReader(raw), len(raw))); uerr == nil && strings.Contains(rerr.Error(), "cluster support disabled") { | |
r.addr = ar.Addr | |
c, err = df("tcp", ar.Addr) | |
} else { | |
err = errors.New("unsupported response from CLUSTER SLOTS") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment