From: Eric Wong Date: Fri, 10 Jan 2025 23:20:10 +0000 (+0000) Subject: (ext)index: move {todo} into $self X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a734d19dd9a7e0d61d53df94cec1668c7ac1ec0e;p=thirdparty%2Fpublic-inbox.git (ext)index: move {todo} into $self Another trivial field to `local'-ize and another step towards eliminating the $sync structure. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 21d91475c..6c578b3b6 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -402,6 +402,7 @@ sub _sync_inbox ($$$) { $self->{nrec} = 0; local $self->{epoch_max}; my $v = $ibx->version; + local $self->{todo}; # set by sync_prepare if ($v == 2) { $self->{epoch_max} = $ibx->max_git_epoch // return; sync_prepare($self, $sync); # or return # TODO: once MiscIdx is stable @@ -412,11 +413,11 @@ sub _sync_inbox ($$$) { return "E: $ibx->{inboxdir} is not indexed"; my $stk = prepare_stack $self, $lc ? "$lc..$head" : $head; my $unit = { stack => $stk, git => $ibx->git }; - push @{$sync->{todo}}, $unit; + push @{$self->{todo}}, $unit; } else { return "E: $ekey unsupported inbox version (v$v)"; } - for my $unit (@{delete($sync->{todo}) // []}) { + for my $unit (@{delete($self->{todo}) // []}) { last if $self->{quit}; index_todo($self, $sync, $unit); } diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index e8d5e0052..0bd49627f 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -965,7 +965,7 @@ sub sync_prepare ($$) { my $nr = $stk ? $stk->num_records : 0; $pr->("$nr\n") if $pr; $unit->{stack} = $stk; # may be undef - unshift @{$sync->{todo}}, $unit; + unshift @{$self->{todo}}, $unit; $regen_max += $nr; } return 0 if $self->{quit}; @@ -1228,10 +1228,8 @@ sub index_sync { $self->{oidx}->rethread_prepare($opt); local $self->{reindex} = $opt->{reindex}; local $self->{mm_tmp}; - my $sync = { - self => $self, - ibx => $self->{ibx}, - }; + local $self->{todo}; # sync_prepare + my $sync = { self => $self, ibx => $self->{ibx} }; my $quit = PublicInbox::SearchIdx::quit_cb $self; local $SIG{QUIT} = $quit; local $SIG{INT} = $quit; @@ -1254,7 +1252,7 @@ sub index_sync { } } # work forwards through history - index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []}; + index_todo($self, $sync, $_) for @{delete($self->{todo}) // []}; $self->{oidx}->rethread_done($opt) unless $self->{quit}; $self->done;