about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-15 09:52:53 +0000
committerEric Wong <e@80x24.org>2021-10-15 15:58:01 +0000
commitea11b7b17d525d20a07d7f62c0334501c5a721b4 (patch)
tree4f6df4242be888948e9879d10cd59ebb9323fd6d /lib/PublicInbox/LeiXSearch.pm
parent738c4a65719e62784fe6baf3781c626b17f3783d (diff)
downloadpublic-inbox-ea11b7b17d525d20a07d7f62c0334501c5a721b4.tar.gz
When importing several sources in parallel via http(s) mboxrd,
we need to be able to get keywords of uncommitted documents
directly from shard workers.  Otherwise, Xapian DocNotFound
errors happen because the read-only LeiSearch won't see
documents from uncomitted transactions.  Keep in mind that it's
possible the keywords can be changed on-the-fly even for
uncommitted documents because of inotify watches from LeiNoteEvent.
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index fba16861..3ec75528 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -282,11 +282,9 @@ sub each_remote_eml { # callback for MboxReader->mboxrd
         my $xoids = $lei->{ale}->xoids_for($eml, 1);
         my $smsg = bless {}, 'PublicInbox::Smsg';
         if ($self->{import_sto} && !$xoids) {
-                my $res = $self->{import_sto}->wq_do('add_eml', $eml);
-                if (ref($res) eq ref($smsg)) { # totally new message
-                        $smsg = $res;
-                        $smsg->{kw} = []; # short-circuit xsmsg_vmd
-                }
+                my ($res, $kw) = $self->{import_sto}->wq_do('add_eml', $eml);
+                $smsg = $res if ref($res) eq ref($smsg); # totally new message
+                $smsg->{kw} = $kw; # short-circuit xsmsg_vmd
         }
         $smsg->{blob} //= $xoids ? (keys(%$xoids))[0]
                                 : $lei->git_oid($eml)->hexdigest;