From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] mbox: hoist out refill_result_ids
Date: Mon, 22 Apr 2024 09:58:01 +0000 [thread overview]
Message-ID: <20240422095801.234442-1-e@80x24.org> (raw)
---
lib/PublicInbox/Mbox.pm | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index 4a0f4681..e58fb4b6 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -175,6 +175,17 @@ sub mbox_all_ids {
PublicInbox::MboxGz::mbox_gz($ctx, \&all_ids_cb, 'all');
}
+sub refill_result_ids ($) {
+ my ($ctx) = @_;
+ # refill result set, deprioritize since there's many results
+ my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
+ my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
+ my $size = $mset->size or return;
+ $ctx->{qopts}->{offset} += $size;
+ $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
+ $ctx->{-low_prio} = 1; # true
+}
+
sub results_cb {
my ($ctx) = @_;
my $over = $ctx->{ibx}->over or return $ctx->gone('over');
@@ -183,13 +194,7 @@ sub results_cb {
my $smsg = $over->get_art($num) or next;
return $smsg;
}
- # refill result set, deprioritize since there's many results
- my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
- my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
- my $size = $mset->size or return;
- $ctx->{qopts}->{offset} += $size;
- $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
- $ctx->{-low_prio} = 1;
+ refill_result_ids($ctx) or return; # refill ctx->{ids}
}
}
@@ -202,19 +207,10 @@ sub results_thread_cb {
my $smsg = $over->get_art($num) or next;
return $smsg;
}
+ next if $over->expand_thread($ctx); # refills ctx->{xids}
- # refills ctx->{xids}
- next if $over->expand_thread($ctx);
-
- # refill result set, deprioritize since there's many results
- my $srch = $ctx->{ibx}->isrch or return $ctx->gone('search');
- my $mset = $srch->mset($ctx->{query}, $ctx->{qopts});
- my $size = $mset->size or return;
- $ctx->{qopts}->{offset} += $size;
- $ctx->{ids} = $srch->mset_to_artnums($mset, $ctx->{qopts});
- $ctx->{-low_prio} = 1;
+ refill_result_ids($ctx) or return; # refill ctx->{ids}
}
-
}
sub mbox_qry_cb { # async_mset cb
reply other threads:[~2024-04-22 9:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240422095801.234442-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).