From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 1/6] cindex: simplify internal structs
Date: Tue, 28 Mar 2023 00:17:17 +0000 [thread overview]
Message-ID: <20230328001722.1415580-1-e@80x24.org> (raw)
---
lib/PublicInbox/CodeSearchIdx.pm | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index e353f452..09b15e5f 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -289,10 +289,9 @@ sub docids_by_postlist ($$) { # consider moving to PublicInbox::Search
@ids;
}
-sub run_todo ($) {
- my ($self) = @_;
+sub run_deferred () {
my $n;
- while (defined(my $x = shift(@{$self->{todo} // []}))) {
+ while (defined(my $x = shift(@{$DEFER // []}))) {
my $cb = shift @$x;
$cb->(@$x);
++$n;
@@ -308,12 +307,12 @@ sub need_reap { # post_loop_do
sub cidx_reap ($$) {
my ($self, $jobs) = @_;
- while (run_todo($self)) {}
+ while (run_deferred()) {}
local @PublicInbox::DS::post_loop_do = (\&need_reap, $jobs);
while (need_reap(undef, $jobs)) {
PublicInbox::DS::event_loop($MY_SIG, $SIGSET);
}
- while (!$jobs && run_todo($self)) {}
+ while (!$jobs && run_deferred()) {}
}
sub cidx_await_cb { # awaitpid cb
@@ -527,7 +526,7 @@ sub index_repo { # cidx_await cb
$consumers->{$repo->{shard_n}} = undef;
commit_used_shards($self, $git, $consumers);
progress($self, "$git->{git_dir}: done");
- return run_todo($self);
+ return run_deferred();
}
die "E: store_repo $git->{git_dir}: id=$id";
}
@@ -750,14 +749,12 @@ sub prep_umask ($) {
sub cidx_run { # main entry point
my ($self) = @_;
my $restore_umask = prep_umask($self);
- local $self->{todo} = [];
- local $DEFER = $self->{todo};
+ local $DEFER = [];
local $SIGSET = PublicInbox::DS::block_signals();
my $restore = PublicInbox::OnDestroy->new($$,
\&PublicInbox::DS::sig_setmask, $SIGSET);
local $LIVE = {};
- local $DO_QUIT;
- local $TMP_GIT;
+ local ($DO_QUIT, $TMP_GIT, $REINDEX);
local @IDX_SHARDS = cidx_init($self);
local $self->{current_info} = '';
local $MY_SIG = {
next reply other threads:[~2023-03-28 0:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 0:17 Eric Wong [this message]
2023-03-28 0:17 ` [PATCH 2/6] cidx: $REINDEX Eric Wong
2023-03-28 0:17 ` [PATCH 3/6] cindex: prefix -cidx_internal Eric Wong
2023-03-28 0:17 ` [PATCH 4/6] git: check for --version errors Eric Wong
2023-03-28 0:17 ` [PATCH 5/6] shards_active DO_QUIT Eric Wong
2023-03-28 0:17 ` [PATCH 6/6] cidx interleaved-prune Eric Wong
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=20230328001722.1415580-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).