Browse Source

Merge pull request #1211 from ming-relax/master

Makes code style consistent in kafka client after refresh metadata
Vlad Gorodetsky 6 years ago
parent
commit
cbccf093cc
1 changed files with 2 additions and 1 deletions
  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)
 	}
 
-	if partitions == nil {
+	// no partitions found after refresh metadata
+	if len(partitions) == 0 {
 		return nil, ErrUnknownTopicOrPartition
 	}