Skip to content

Commit

Permalink
loadCoordinator: patch HEAD^^
Browse files Browse the repository at this point in the history
... ... very shortly I will no longer be developing primarily on a mac
  • Loading branch information
twmb committed May 13, 2021
1 parent 802242d commit ef9a16a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/kgo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,15 @@ type coordinatorLoad struct {
func (cl *Client) loadCoordinator(reload bool, ctx context.Context, key coordinatorKey) (*broker, error) {
cl.coordinatorsMu.Lock()
c, ok := cl.coordinators[key]
if !ok {
if reload || !ok {
c = &coordinatorLoad{
done: make(chan struct{}), // all requests for the same coordinator get collapsed into one
}
defer func() {
if c.err != nil { // if our load fails, we avoid caching the coordinator
cl.coordinatorsMu.Lock()
delete(cl.coordinators, key)
cl.coordinatorsMu.Lock()
cl.coordinatorsMu.Unlock()
}
close(c.done)
}()
Expand Down

0 comments on commit ef9a16a

Please sign in to comment.