From 97695693f24990429118e879bf0c04beb8163bce Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Thu, 11 Jul 2024 19:21:36 +0200 Subject: [PATCH] (index-prio) Don't increment readItems counter when the output buffer is full This behavior was causing the reader to sometimes discard trailing entries in the list. --- .../java/nu/marginalia/index/PrioIndexEntrySource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/index/index-reverse/java/nu/marginalia/index/PrioIndexEntrySource.java b/code/index/index-reverse/java/nu/marginalia/index/PrioIndexEntrySource.java index e55a4235..6346290f 100644 --- a/code/index/index-reverse/java/nu/marginalia/index/PrioIndexEntrySource.java +++ b/code/index/index-reverse/java/nu/marginalia/index/PrioIndexEntrySource.java @@ -68,7 +68,7 @@ public class PrioIndexEntrySource implements EntrySource { var outputBuffer = buffer.asByteBuffer().order(ByteOrder.LITTLE_ENDIAN); outputBuffer.clear(); - while (readItems++ < numItems && outputBuffer.hasRemaining()) { + while (outputBuffer.hasRemaining() && readItems++ < numItems) { fillReadBuffer(); int rank;