From f2364c5765f0692d2f1e82b61804359a38f3fdfc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Dec 2019 07:51:04 +0000 Subject: search: retry_reopen passes user arg to callback 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 --- lib/PublicInbox/SearchMsg.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/SearchMsg.pm') diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm index 53882f73..ea54ba8a 100644 --- a/lib/PublicInbox/SearchMsg.pm +++ b/lib/PublicInbox/SearchMsg.pm @@ -92,10 +92,11 @@ sub psgi_cull ($) { } # Only called by PSGI interface, not NNTP -sub load_doc { - my ($class, $doc) = @_; - my $self = bless {}, $class; - psgi_cull(load_expand($self, $doc)); +sub from_mitem { + my ($mitem, $srch) = @_; + return $srch->retry_reopen(\&from_mitem, $mitem) if $srch; + my $self = bless {}, __PACKAGE__; + psgi_cull(load_expand($self, $mitem->get_document)); } # :bytes and :lines metadata in RFC 3977 -- cgit v1.2.3-24-ge0c7