Skip to content

Commit

Permalink
Minor formatting fixes and code simplification
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <drreta@gmail.com>
  • Loading branch information
reta committed Apr 12, 2024
1 parent 9705256 commit 4369ade
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,14 @@ int doDrain(SpanWithSizeConsumer<S> consumer) {
metrics.incrementSpanBytes(nextSizeInBytes);

if (messageSizeOfNextSpan > messageMaxBytes) {
drainedCount++;
metrics.incrementSpansDropped(1);
elements[readPos] = null; // should have been dropped before
if (++readPos == elements.length) readPos = 0; // circle back to the front of the array
} else if (consumer.offer(next, nextSizeInBytes)) {
drainedCount++;

elements[readPos] = null;
if (++readPos == elements.length) readPos = 0; // circle back to the front of the array
} else {
metrics.incrementSpansDropped(1);
} else if (!consumer.offer(next, nextSizeInBytes)) {
break;
}

drainedCount++;
elements[readPos] = null;
if (++readPos == elements.length) readPos = 0; // circle back to the front of the array
}
count -= drainedCount;
return drainedCount;
Expand Down

0 comments on commit 4369ade

Please sign in to comment.