Skip to content

Commit

Permalink
Merge pull request #414 from Shopify/none_struct
Browse files Browse the repository at this point in the history
Use a none map for the toRetry topics instead of bool
  • Loading branch information
wvanbergen committed Apr 11, 2015
2 parents 00ec000 + 42e484d commit fb1ac37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ func (client *client) updateMetadata(data *MetadataResponse) ([]string, error) {
client.registerBroker(broker)
}

toRetry := make(map[string]bool)
toRetry := make(map[string]none)

var err error
for _, topic := range data.Topics {
Expand All @@ -615,10 +615,10 @@ func (client *client) updateMetadata(data *MetadataResponse) ([]string, error) {
continue
case ErrUnknownTopicOrPartition: // retry, do not store partial partition results
err = topic.Err
toRetry[topic.Name] = true
toRetry[topic.Name] = none{}
continue
case ErrLeaderNotAvailable: // retry, but store partiial partition results
toRetry[topic.Name] = true
toRetry[topic.Name] = none{}
break
default: // don't retry, don't store partial results
Logger.Printf("Unexpected topic-level metadata error: %s", topic.Err)
Expand All @@ -630,7 +630,7 @@ func (client *client) updateMetadata(data *MetadataResponse) ([]string, error) {
for _, partition := range topic.Partitions {
client.metadata[topic.Name][partition.ID] = partition
if partition.Err == ErrLeaderNotAvailable {
toRetry[topic.Name] = true
toRetry[topic.Name] = none{}
}
}

Expand Down

0 comments on commit fb1ac37

Please sign in to comment.