mirror of
				https://github.com/redis/go-redis.git
				synced 2025-11-04 02:33:24 +03:00 
			
		
		
		
	Merge pull request #2173 from go-redis/fix/cluster-slots-redis-7
fix: fix ClusterSlots to read full metadata
This commit is contained in:
		@@ -2822,19 +2822,14 @@ func (cmd *ClusterSlotsCmd) readReply(rd *proto.Reader) error {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if nn >= 4 {
 | 
								if nn >= 4 {
 | 
				
			||||||
				networkingMetadata := make(map[string]string)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				metadataLength, err := rd.ReadMapLen()
 | 
									metadataLength, err := rd.ReadMapLen()
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return err
 | 
										return err
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if metadataLength%2 != 0 {
 | 
									networkingMetadata := make(map[string]string, metadataLength)
 | 
				
			||||||
					return fmt.Errorf(
 | 
					 | 
				
			||||||
						"got %d elements in metadata, expected an even number", metadataLength)
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for i := 0; i < metadataLength; i += 2 {
 | 
									for i := 0; i < metadataLength; i++ {
 | 
				
			||||||
					key, err := rd.ReadString()
 | 
										key, err := rd.ReadString()
 | 
				
			||||||
					if err != nil {
 | 
										if err != nil {
 | 
				
			||||||
						return err
 | 
											return err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user