Skip to content

Commit

Permalink
add locking to g.uncommitted MarkCommitRecords
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
  • Loading branch information
vtolstov committed Sep 2, 2021
1 parent f2002b3 commit 082db89
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kgo/consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,10 @@ func (cl *Client) MarkCommitRecords(rs ...*Record) {
rs[i].Topic == rs[j].Topic && rs[i].Partition < rs[j].Partition
})

// protect g.uncommitted map
g.mu.Lock()
defer g.mu.Unlock()

if g.uncommitted == nil {
g.uncommitted = make(uncommitted)
}
Expand Down

0 comments on commit 082db89

Please sign in to comment.