From 107123dd03f38b97579ce5976f31ae3fd5f22903 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Fri, 23 Mar 2018 02:03:46 +0000 Subject: search: reopen DB if each_smsg_by_mid fails This gives more-up-to-date data in case and allows us to avoid reopening in more places ourselves. --- lib/PublicInbox/Search.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 24600ee7..a4e2498e 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -417,6 +417,11 @@ sub each_smsg_by_mid { my $term = 'Q' . $mid; my $head = $db->postlist_begin($term); my $tail = $db->postlist_end($term); + if ($head == $tail) { + $db->reopen; + $head = $db->postlist_begin($term); + $tail = $db->postlist_end($term); + } return ($head, $tail, $db) if wantarray; for (; $head->nequal($tail); $head->inc) { my $doc_id = $head->get_docid; -- cgit v1.2.3-24-ge0c7