about summary refs log tree commit homepage
path: root/lib/PublicInbox/IMAP.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-21 19:23:25 +0000
committerEric Wong <e@yhbt.net>2020-06-23 00:22:06 +0000
commita5c21c6e800be4755848621ba223594b0bde4d95 (patch)
tree7b77d1b434b6dd75cbb20930013adb5ddfcac456 /lib/PublicInbox/IMAP.pm
parent7d626338a6bf02c1098ba16302f5c13be0370673 (diff)
downloadpublic-inbox-a5c21c6e800be4755848621ba223594b0bde4d95.tar.gz
There's no need to loop when the first iteration guarantees
a `return'.
Diffstat (limited to 'lib/PublicInbox/IMAP.pm')
-rw-r--r--lib/PublicInbox/IMAP.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm
index d8b1fce1..dec10d61 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