Sfoglia il codice sorgente

Merge pull request #1211 from ming-relax/master

Makes code style consistent in kafka client after refresh metadata
Vlad Gorodetsky 6 anni fa
parent
commit
cbccf093cc
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      client.go

+ 2 - 1
client.go

@@ -288,7 +288,8 @@ func (client *client) Partitions(topic string) ([]int32, error) {
 		partitions = client.cachedPartitions(topic, allPartitions)
 		partitions = client.cachedPartitions(topic, allPartitions)
 	}
 	}
 
 
-	if partitions == nil {
+	// no partitions found after refresh metadata
+	if len(partitions) == 0 {
 		return nil, ErrUnknownTopicOrPartition
 		return nil, ErrUnknownTopicOrPartition
 	}
 	}