Skip to content

Commit

Permalink
Asynchronously close brokers during a RefreshBrokers
Browse files Browse the repository at this point in the history
  • Loading branch information
bmassemin committed Oct 26, 2023
1 parent 3ca69a8 commit ddf302b
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 ddf302b

Please sign in to comment.