about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-23 02:03:46 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-23 02:03:46 +0000
commit107123dd03f38b97579ce5976f31ae3fd5f22903 (patch)
tree59e97d53b3db9c691828da321e8795716820da2c /lib/PublicInbox/Search.pm
parent41654a8cd9372c0640c4ca5339e5881927965e41 (diff)
downloadpublic-inbox-107123dd03f38b97579ce5976f31ae3fd5f22903.tar.gz
This gives more-up-to-date data in case and allows us
to avoid reopening in more places ourselves.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm5
1 files changed, 5 insertions, 0 deletions
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;