Browse Source

If the error message is LeaderNotAvailable, don't even look for a leader

Evan Huus 11 years ago
parent
commit
722e2eeb76
1 changed files with 3 additions and 0 deletions
  1. 3 0
      client.go

+ 3 - 0
client.go

@@ -432,6 +432,9 @@ func (client *Client) cachedLeader(topic string, partitionID int32) (*Broker, er
 	if partitions != nil {
 	if partitions != nil {
 		metadata, ok := partitions[partitionID]
 		metadata, ok := partitions[partitionID]
 		if ok {
 		if ok {
+			if metadata.Err == LeaderNotAvailable {
+				return nil, LeaderNotAvailable
+			}
 			b := client.brokers[metadata.Leader]
 			b := client.brokers[metadata.Leader]
 			if b == nil {
 			if b == nil {
 				return nil, LeaderNotAvailable
 				return nil, LeaderNotAvailable