There's no need to loop when the first iteration guarantees
a `return'.
---
 lib/PublicInbox/IMAP.pm | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm
index 0508ae381dd..941ce3af495 100644
--- a/lib/PublicInbox/IMAP.pm
+++ b/lib/PublicInbox/IMAP.pm
@@ -1172,16 +1172,13 @@ sub refill_xap ($$$$) {
        my $srch = $self->{ibx}->search;
        my $opt = { mset => 2, limit => 1000 };
        my $nshard = $srch->{nshard} // 1;
-       while (1) {
-               my $mset = $srch->query("$q uid:$beg..$end", $opt);
-               @$uids = map { mdocid($nshard, $_) } $mset->items;
-               if (@$uids) {
-                       $range_info->[0] = $uids->[-1] + 1; # update $beg
-                       return;
-               } else { # all done
-                       return 0;
-               }
+       my $mset = $srch->query("$q uid:$beg..$end", $opt);
+       @$uids = map { mdocid($nshard, $_) } $mset->items;
+       if (@$uids) {
+               $range_info->[0] = $uids->[-1] + 1; # update $beg
+               return; # possibly more
        }
+       0; # all done
 }
 
 sub search_xap_range { # long_response
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to