about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-22 21:17:53 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-02-28 18:45:35 +0000
commitebc3f825c1eb95399c575fff816180a6e4fffeb6 (patch)
tree0d71e915376dbf05b251881eeef00cc2d8e36156
parent126d94b10886b02a3936f1429cab1eaea21b6025 (diff)
downloadpublic-inbox-ebc3f825c1eb95399c575fff816180a6e4fffeb6.tar.gz
Relying more on Xapian requires retrying reopens in more
places to ensure it does not fall down and show errors to
the user.
-rw-r--r--lib/PublicInbox/Inbox.pm8
-rw-r--r--lib/PublicInbox/Search.pm3
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index f000a950..54a6eb32 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -254,9 +254,11 @@ sub msg_by_mid ($$;$) {
         my ($self, $mid, $ref) = @_;
         my $srch = search($self) or
                         return msg_by_path($self, mid2path($mid), $ref);
-        my $smsg = $srch->lookup_skeleton($mid) or return;
-        $smsg->load_expand;
-        msg_by_smsg($self, $smsg, $ref);
+        my $smsg;
+        $srch->retry_reopen(sub {
+                $smsg = $srch->lookup_skeleton($mid) and $smsg->load_expand;
+        });
+        $smsg ? msg_by_smsg($self, $smsg, $ref) : undef;
 }
 
 1;
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index b20b2ccd..1df87d0e 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -185,7 +185,7 @@ sub query {
 
 sub get_thread {
         my ($self, $mid, $opts) = @_;
-        my $smsg = eval { $self->lookup_skeleton($mid) };
+        my $smsg = retry_reopen($self, sub { lookup_skeleton($self, $mid) });
 
         return { total => 0, msgs => [] } unless $smsg;
         my $qtid = Search::Xapian::Query->new('G' . $smsg->thread_id);
@@ -216,6 +216,7 @@ sub retry_reopen {
                 if (ref($@) eq 'Search::Xapian::DatabaseModifiedError') {
                         reopen($self);
                 } else {
+                        warn "ref: ", ref($@), "\n";
                         die;
                 }
         }