From 66e014bdbd6eabc45e717ec7f619e9aa6c48b6d7 Mon Sep 17 00:00:00 2001 From: gdoser Date: Wed, 1 Aug 2018 18:17:36 +0200 Subject: [PATCH] Handle ErrReplicaNotAvailable in metadata.refresh --- metadata.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata.go b/metadata.go index 301b447..26d9846 100644 --- a/metadata.go +++ b/metadata.go @@ -187,7 +187,7 @@ func (m *Metadata) refreshIfExpired(topic string, ttl time.Time) error { func (m *Metadata) refresh(topics []string) error { topicMetadataResponse, err := m.connector.GetTopicMetadata(topics) - if err != nil { + if err != nil && err != ErrReplicaNotAvailable { return err } @@ -196,13 +196,13 @@ func (m *Metadata) refresh(topics []string) error { } for _, topicMetadata := range topicMetadataResponse.TopicsMetadata { - if topicMetadata.Error != ErrNoError { + if topicMetadata.Error != ErrNoError && topicMetadata.Error != ErrReplicaNotAvailable { return topicMetadata.Error } partitionLeaders := make(map[int32]int32) for _, partitionMetadata := range topicMetadata.PartitionsMetadata { - if partitionMetadata.Error != ErrNoError { + if partitionMetadata.Error != ErrNoError && partitionMetadata.Error != ErrReplicaNotAvailable { return partitionMetadata.Error }