From: Eric Wong Date: Fri, 10 Jan 2025 23:20:13 +0000 (+0000) Subject: (ext)index: move {unindexed} to $self X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2d0ce3edf1a603ed1dc89fbbfce98672b38ba87;p=thirdparty%2Fpublic-inbox.git (ext)index: move {unindexed} to $self As with most things that were formerly in $sync, we can just rely on `local' to flatten the data structure graph and work towards eliminating $sync. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 807666fc8..7ccfb1db5 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -403,6 +403,7 @@ sub _sync_inbox ($$$) { local $self->{epoch_max}; my $v = $ibx->version; local $self->{todo}; # set by sync_prepare + local $self->{unindexed}; if ($v == 2) { $self->{epoch_max} = $ibx->max_git_epoch // return; sync_prepare($self, $sync); # or return # TODO: once MiscIdx is stable diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 548d8bde0..6b43bac14 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -746,16 +746,14 @@ sub index_oid { # cat_async callback } # {unindexed} is unlikely - if (my $unindexed = $arg->{unindexed}) { + if (my $unindexed = $self->{unindexed}) { my $oidbin = pack('H*', $oid); my $u = $unindexed->{$oidbin}; ($num, $mid0) = splice(@$u, 0, 2) if $u; if (defined $num) { $self->{mm}->mid_set($num, $mid0); - if (scalar(@$u) == 0) { # done with current OID - delete $unindexed->{$oidbin}; - delete($arg->{unindexed}) if !keys(%$unindexed); - } + # done w/ current OID? + delete $unindexed->{$oidbin} if !@$u; } } my $oidx = $self->{oidx}; @@ -1014,7 +1012,7 @@ sub unindex_oid ($$;$) { # git->cat_async callback return index_finalize($arg, 0); my $self = $arg->{self}; local $self->{current_info} = "$self->{current_info} $oid"; - my $unindexed = $self->{in_unindex} ? $arg->{unindexed} : undef; + my $unindexed = $self->{in_unindex} ? $self->{unindexed} : undef; my $mm = $self->{mm}; my $mids = mids(PublicInbox::Eml->new($bref)); undef $$bref; @@ -1052,7 +1050,7 @@ sub git { $_[0]->{ibx}->git } sub unindex_todo ($$$) { my ($self, $sync, $unit) = @_; my $unindex_range = delete($unit->{unindex_range}) // return; - my $unindexed = $sync->{unindexed} //= {}; # $oidbin => [$num, $mid0] + my $unindexed = $self->{unindexed} //= {}; # $oidbin => [$num, $mid0] my $before = scalar keys %$unindexed; # order does not matter, here: my $fh = $unit->{git}->popen(qw(log --raw -r --no-notes --no-color @@ -1236,6 +1234,7 @@ sub index_sync { local $self->{reindex} = $opt->{reindex}; local $self->{mm_tmp}; local $self->{todo}; # sync_prepare + local $self->{unindexed}; my $sync = { self => $self, ibx => $self->{ibx} }; my $quit = PublicInbox::SearchIdx::quit_cb $self; local $SIG{QUIT} = $quit;