Skip to content

Commit

Permalink
Asynchronously close brokers during a RefreshBrokers (#2693)
Browse files Browse the repository at this point in the history
Signed-off-by: Baptiste Massemin <baptiste.massemin@shopify.com>
  • Loading branch information
bmassemin authored Oct 30, 2023
1 parent ee1944b commit 82f0e48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82f0e48

Please sign in to comment.