From 2bf59eb5f8d890596818d0ecfe724e8e16c61ec7 Mon Sep 17 00:00:00 2001 From: Baptiste Massemin Date: Thu, 26 Oct 2023 17:06:04 +0200 Subject: [PATCH] Asynchronously close brokers during a RefreshBrokers Signed-off-by: Baptiste Massemin --- client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index c6364eead..2decba7c5 100644 --- a/client.go +++ b/client.go @@ -519,16 +519,16 @@ func (client *client) RefreshBrokers(addrs []string) error { defer client.lock.Unlock() for _, broker := range client.brokers { - _ = broker.Close() - delete(client.brokers, broker.ID()) + safeAsyncClose(broker) } + client.brokers = make(map[int32]*Broker) for _, broker := range client.seedBrokers { - _ = broker.Close() + safeAsyncClose(broker) } for _, broker := range client.deadSeeds { - _ = broker.Close() + safeAsyncClose(broker) } client.seedBrokers = nil