From: Eric Wong Date: Sat, 10 Aug 2024 09:00:08 +0000 (+0000) Subject: extindex: avoid branch in ->index_eml X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b680a6d72147a8ea82d5af997da550c74d353642;p=thirdparty%2Fpublic-inbox.git extindex: avoid branch in ->index_eml We'll probably be stuffing more extindex-specific fields in here, so it simplifies our internal API. --- diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 934197c05..68700c8b8 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -245,7 +245,8 @@ sub index_unseen ($) { my $oid = $new_smsg->{blob}; my $ibx = delete $req->{ibx} or die 'BUG: {ibx} unset'; $self->{oidx}->add_xref3($docid, $req->{xnum}, $oid, $ibx->eidx_key); - $idx->index_eml($eml, $new_smsg, $ibx->eidx_key); + $new_smsg->{eidx_key} = $ibx->eidx_key; + $idx->index_eml($eml, $new_smsg); check_batch_limit($req); } @@ -578,7 +579,8 @@ sub _reindex_finalize ($$$) { my $top_smsg = pop @$stable; $top_smsg == $smsg or die 'BUG: top_smsg != smsg'; my $ibx = _ibx_for($self, $sync, $smsg); - $idx->index_eml($eml, $smsg, $ibx->eidx_key); + $smsg->{eidx_key} = $ibx->eidx_key; + $idx->index_eml($eml, $smsg); for my $x (reverse @$stable) { $ibx = _ibx_for($self, $sync, $x); my $hdr = delete $x->{hdr} // die 'BUG: no {hdr}'; diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index ea261bdab..7ee8a1214 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -49,8 +49,7 @@ sub ipc_atfork_child { # called automatically before ipc_worker_loop } sub index_eml { - my ($self, $eml, $smsg, $eidx_key) = @_; - $smsg->{eidx_key} = $eidx_key if defined $eidx_key; + my ($self, $eml, $smsg) = @_; $self->ipc_do('add_xapian', $eml, $smsg); }