From 82f0e48b0e2b6dfefc3088fe5e45195f6cc461d8 Mon Sep 17 00:00:00 2001 From: Baptiste Massemin <55845846+bmassemin@users.noreply.github.com> Date: Mon, 30 Oct 2023 16:51:06 +0100 Subject: [PATCH] Asynchronously close brokers during a RefreshBrokers (#2693) 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