From c403eb0f14f317c0ef4375d732b9bf2b92348380 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Jan 2025 23:20:08 +0000 Subject: [PATCH] extindex: move {dedupe_cull} to self This allows us to eliminate the $per_mid->{sync} field used for dedupe, as well. --- lib/PublicInbox/ExtSearchIdx.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 738028131..f6d0a7cc1 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -1024,7 +1024,7 @@ sub dd_smsg { # git->cat_async callback while (my ($chash, $ary) = each %{$per_mid->{dd_chash}}) { my $keep = shift @$ary; next if !scalar(@$ary); - $per_mid->{sync}->{dedupe_cull} += scalar(@$ary); + $per_mid->{self}->{dedupe_cull} += scalar(@$ary); print STDERR "# <$keep->{mid}> keeping #$keep->{num}, dropping ", join(', ', map { "#$_->{num}" } @$ary),"\n"; @@ -1040,7 +1040,7 @@ sub dd_smsg { # git->cat_async callback sub eidx_dedupe ($$$) { my ($self, $sync, $msgids) = @_; - $sync->{dedupe_cull} = 0; + local $self->{dedupe_cull} = 0; my $candidates = 0; my $nr_mid = 0; return unless eidxq_lock_acquire($self); @@ -1079,7 +1079,6 @@ EOS my $per_mid = { dd_chash => {}, # chash => [ary of smsgs] last_smsg => $smsg[-1], - sync => $sync }; $nr_mid++; $candidates += scalar(@smsg) - 1; @@ -1104,7 +1103,7 @@ EOS } goto dedupe_restart if defined($msgids->[++$idx]); - my $n = delete $sync->{dedupe_cull}; + my $n = delete $self->{dedupe_cull}; if (my $pr = $self->{-opt}->{-progress}) { $pr->("culled $n/$candidates candidates ($nr_mid msgids)\n"); } -- 2.47.3