Browse Source

client: recognize full-topic leader election

Apparently my assumption in 1b465e78c274a76c0a522272cac25e39ddaa0d07 was false,
and `LeaderNotAvailable` can also appear at the topic level (not just the
partition level).

Possibly fixes #251
Evan Huus 11 years ago
parent
commit
1e3e79af80
1 changed files with 7 additions and 1 deletions
  1. 7 1
      client.go

+ 7 - 1
client.go

@@ -528,7 +528,13 @@ func (client *Client) update(data *MetadataResponse) ([]string, error) {
 
 
 	var err error
 	var err error
 	for _, topic := range data.Topics {
 	for _, topic := range data.Topics {
-		if topic.Err != NoError {
+		switch topic.Err {
+		case NoError:
+			break
+		case LeaderNotAvailable:
+			toRetry[topic.Name] = true
+			continue
+		default:
 			err = topic.Err
 			err = topic.Err
 			continue
 			continue
 		}
 		}