unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] lei_search: xsmsg_vmd: retry_reopen properly
@ 2021-09-06  7:20 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-09-06  7:20 UTC (permalink / raw)
  To: meta

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 | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm
index 47160ed9..a10e6e17 100644
--- a/lib/PublicInbox/LeiSearch.pm
+++ b/lib/PublicInbox/LeiSearch.pm
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-06  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  7:20 [PATCH] lei_search: xsmsg_vmd: retry_reopen properly Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).