about summary refs log tree commit homepage
path: root/lib/PublicInbox/Mbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-25 07:51:04 +0000
committerEric Wong <e@80x24.org>2019-12-28 19:38:23 +0000
commitf2364c5765f0692d2f1e82b61804359a38f3fdfc (patch)
tree2b0507af4558629169cc5ea1e48efd79cb8f015f /lib/PublicInbox/Mbox.pm
parentb316f7541ec263fd04ea50530a1d500f43773299 (diff)
downloadpublic-inbox-f2364c5765f0692d2f1e82b61804359a38f3fdfc.tar.gz
This allows callers to pass named (not anonymous) subs.

Update all retry_reopen callers to use this feature, and
fix some places where we failed to use retry_reopen :x
Diffstat (limited to 'lib/PublicInbox/Mbox.pm')
-rw-r--r--lib/PublicInbox/Mbox.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index 3fdda5ea..1f9ac6ec 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -12,6 +12,7 @@ use strict;
 use warnings;
 use PublicInbox::MID qw/mid_escape/;
 use PublicInbox::Hval qw/to_filename/;
+use PublicInbox::SearchMsg;
 use Email::Simple;
 use Email::MIME::Encode;
 
@@ -204,10 +205,8 @@ sub results_cb {
         my $srch = $ctx->{srch};
         while (1) {
                 while (my $mi = (($mset->items)[$ctx->{iter}++])) {
-                        my $doc = $mi->get_document;
-                        my $smsg = $srch->retry_reopen(sub {
-                                PublicInbox::SearchMsg->load_doc($doc);
-                        }) or next;
+                        my $smsg = PublicInbox::SearchMsg::from_mitem($mi,
+                                                                $srch) or next;
                         return $smsg;
                 }
                 # refill result set