]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
search: reopen DB if each_smsg_by_mid fails
[public-inbox.git] / lib / PublicInbox / Search.pm
index 24600ee7574e62feff60d40f46fd792e69d32747..a4e2498eb596d1cd9346b6620ffa464aa5a1ce6d 100644 (file)
@@ -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;