Skip to content

Commit

Permalink
kgo: fix race condition in close
Browse files Browse the repository at this point in the history
  • Loading branch information
matino committed May 15, 2023
1 parent 88d5c46 commit ee3d7c1
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 @@ -948,7 +948,7 @@ func (cl *Client) Close() {

sessCloseCtx, sessCloseCancel := context.WithTimeout(cl.ctx, time.Second)
var wg sync.WaitGroup
for _, sns := range cl.sinksAndSources {
cl.allSinksAndSources(func(sns sinkAndSource) {
if sns.source.session.id != 0 {
sns := sns
wg.Add(1)
Expand All @@ -957,7 +957,7 @@ func (cl *Client) Close() {
sns.source.killSessionOnClose(sessCloseCtx)
}()
}
}
})
wg.Wait()
sessCloseCancel()

Expand Down

0 comments on commit ee3d7c1

Please sign in to comment.