From a5a3dd2f284f910a95e798e74b5f9bb6a8358a11 Mon Sep 17 00:00:00 2001 From: Robert Laszczak Date: Fri, 1 Nov 2019 16:23:11 +0100 Subject: [PATCH] fixed panic on calling updateMetadata on closed client --- client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client.go b/client.go index 040cfe9e3..7833d3f2a 100644 --- a/client.go +++ b/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()