Browse Source

fixed panic on calling updateMetadata on closed client

Robert Laszczak 6 năm trước cách đây
mục cha
commit
a5a3dd2f28
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      client.go

+ 4 - 0
client.go

@@ -833,6 +833,10 @@ func (client *client) tryRefreshMetadata(topics []string, attemptsRemaining int,
 
 // if no fatal error, returns a list of topics that need retrying due to ErrLeaderNotAvailable
 func (client *client) updateMetadata(data *MetadataResponse, allKnownMetaData bool) (retry bool, err error) {
+	if client.Closed() {
+		return
+	}
+
 	client.lock.Lock()
 	defer client.lock.Unlock()