From 0d096c1f3d90582425ad8b631de6920352d3f8f9 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Thu, 12 Dec 2024 04:50:26 -0500 Subject: [PATCH] PR FIXUP - Tweak currentKV Is technically more correct, and unlikely to have a meaningful impact on performance --- internal/db/fetcher/document.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/db/fetcher/document.go b/internal/db/fetcher/document.go index fe650499fb..8f2c7ee49a 100644 --- a/internal/db/fetcher/document.go +++ b/internal/db/fetcher/document.go @@ -106,11 +106,13 @@ func (f *documentFetcher) NextDoc() (immutable.Option[string], error) { return immutable.None[string](), err } - if dsKey.DocID != f.currentKV.Key.DocID { - f.currentKV = keyValue{ - Key: dsKey, - Value: res.Value, - } + previousKV := f.currentKV + f.currentKV = keyValue{ + Key: dsKey, + Value: res.Value, + } + + if dsKey.DocID != previousKV.Key.DocID { break } }