Skip to content

Commit

Permalink
fix(core): close consumer when returning null after calculating offse…
Browse files Browse the repository at this point in the history
…t for newest sort (#1069)

fix a memory leak 

Co-authored-by: Neeraj.singh <email@test.com>
  • Loading branch information
neeraj-singh47 and Neeraj.singh authored Aug 23, 2022
1 parent 22a5d79 commit 24fde0e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/akhq/repositories/RecordRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ private Optional<EndOffsetBound> getOffsetForSortNewest(KafkaConsumer<byte[], by
}

if (last == partition.getFirstOffset() || last < 0) {
consumer.close();
return null;
} else if (!(last - pollSizePerPartition < first)) {
first = last - pollSizePerPartition;
Expand Down

0 comments on commit 24fde0e

Please sign in to comment.