Skip to content

Commit

Permalink
bugfix: RefreshController leaks the broker that was the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
k-wall committed Apr 1, 2022
1 parent 9473433 commit 4f9c5fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,10 @@ func (client *client) Controller() (*Broker, error) {
func (client *client) deregisterController() {
client.lock.Lock()
defer client.lock.Unlock()
delete(client.brokers, client.controllerID)
if controller, ok := client.brokers[client.controllerID]; ok {
_ = controller.Close()
delete(client.brokers, client.controllerID)
}
}

// RefreshController retrieves the cluster controller from fresh metadata
Expand Down

0 comments on commit 4f9c5fe

Please sign in to comment.