Skip to content

Commit

Permalink
[improve][broker] Optimize high CPU usage when consuming from topics …
Browse files Browse the repository at this point in the history
…with ongoing txn (#23189)

(cherry picked from commit 94e1341)
  • Loading branch information
coderzc committed Aug 21, 2024
1 parent 34c6fa0 commit b7ffa73
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ public void asyncReadEntriesWithSkipOrWait(int maxEntries, long maxSizeBytes, Re

int numberOfEntriesToRead = applyMaxSizeCap(maxEntries, maxSizeBytes);

if (hasMoreEntries()) {
if (hasMoreEntries() && maxPosition.compareTo(readPosition) >= 0) {
// If we have available entries, we can read them immediately
if (log.isDebugEnabled()) {
log.debug("[{}] [{}] Read entries immediately", ledger.getName(), name);
Expand Down

0 comments on commit b7ffa73

Please sign in to comment.