Skip to content

Commit

Permalink
M
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Ángel Ortuño <ortuman@gmail.com>
  • Loading branch information
ortuman committed Sep 23, 2024
1 parent fc5a7a3 commit a85f7a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/kgo/record_and_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,17 @@ type Record struct {
// enrichment to consumer clients.
Context context.Context

// recordsPool is the pool that this record was fetched from, if any.
//
// When reused, record is returned to this pool.
recordsPool recordsPool
}

// Release releases the record back to the pool.
// This should be called after the record is no longer needed.
func (r *Record) Release() {
// Reuse releases the record back to the pool.
//
// Once this method has been called, any reference to the passed record should be considered invalid by the caller,
// as it may be reused as a result of future calls to the PollFetches/PollRecords method.
func (r *Record) Reuse() {
r.recordsPool.put(r)
}

Expand Down

0 comments on commit a85f7a4

Please sign in to comment.