Merge pull request #2173 from go-redis/fix/cluster-slots-redis-7

fix: fix ClusterSlots to read full metadata
This commit is contained in:
Vladimir Mihailenco 2022-07-29 14:43:43 +03:00 committed by GitHub
commit ce016ed85f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -2822,19 +2822,14 @@ func (cmd *ClusterSlotsCmd) readReply(rd *proto.Reader) error {
}
if nn >= 4 {
networkingMetadata := make(map[string]string)
metadataLength, err := rd.ReadMapLen()
if err != nil {
return err
}
if metadataLength%2 != 0 {
return fmt.Errorf(
"got %d elements in metadata, expected an even number", metadataLength)
}
networkingMetadata := make(map[string]string, metadataLength)
for i := 0; i < metadataLength; i += 2 {
for i := 0; i < metadataLength; i++ {
key, err := rd.ReadString()
if err != nil {
return err