]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_search: xsmsg_vmd: retry_reopen properly
authorEric Wong <e@80x24.org>
Mon, 6 Sep 2021 07:20:12 +0000 (07:20 +0000)
committerEric Wong <e@80x24.org>
Mon, 6 Sep 2021 11:05:41 +0000 (11:05 +0000)
The deeper eval was preventing retry_reopen from retrying
with readers and writers working in parallel:

  FOO=imaps://example.com/INBOX.huge
  lei lcat $FOO -f mboxcl | lei tag -F mboxcl +L:bar -

Fixes: c7bcfe6cd6648ff0 ("lei: diagnostics for /Document \d+ not found/ errors")
lib/PublicInbox/LeiSearch.pm

index 47160ed98b7a81a4988cd9187fb8afd55a177217..a10e6e1767755c4375d2249dd4799881869bcbfb 100644 (file)
@@ -55,17 +55,13 @@ sub _xsmsg_vmd { # retry_reopen
        $kw{flagged} = 1 if delete($smsg->{lei_q_tt_flagged});
        my @num = $self->over->blob_exists($smsg->{blob});
        for my $num (@num) { # there should only be one...
-               eval {
-                       $doc = $xdb->get_document(num2docid($self, $num));
-                       $x = xap_terms('K', $doc);
-                       %kw = (%kw, %$x);
-                       if ($want_label) { # JSON/JMAP only
-                               $x = xap_terms('L', $doc);
-                               %L = (%L, %$x);
-                       }
-               };
-               warn "$$ $0 #$num (nshard=$self->{nshard}) $smsg->{blob}: $@"
-                       if $@;
+               $doc = $xdb->get_document(num2docid($self, $num));
+               $x = xap_terms('K', $doc);
+               %kw = (%kw, %$x);
+               if ($want_label) { # JSON/JMAP only
+                       $x = xap_terms('L', $doc);
+                       %L = (%L, %$x);
+               }
        }
        $smsg->{kw} = [ sort keys %kw ] if scalar(keys(%kw));
        $smsg->{L} = [ sort keys %L ] if scalar(keys(%L));
@@ -75,7 +71,8 @@ sub _xsmsg_vmd { # retry_reopen
 sub xsmsg_vmd {
        my ($self, $smsg, $want_label) = @_;
        return if $smsg->{kw}; # already set by LeiXSearch->mitem_kw
-       $self->retry_reopen(\&_xsmsg_vmd, $smsg, $want_label);
+       eval { $self->retry_reopen(\&_xsmsg_vmd, $smsg, $want_label) };
+       warn "$$ $0 (nshard=$self->{nshard}) $smsg->{blob}: $@" if $@;
 }
 
 # when a message has no Message-IDs at all, this is needed for