diff options
author | Eric Wong <e@80x24.org> | 2019-12-25 07:51:04 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-28 19:38:23 +0000 |
commit | f2364c5765f0692d2f1e82b61804359a38f3fdfc (patch) | |
tree | 2b0507af4558629169cc5ea1e48efd79cb8f015f /lib/PublicInbox/ExtMsg.pm | |
parent | b316f7541ec263fd04ea50530a1d500f43773299 (diff) | |
download | public-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/ExtMsg.pm')
-rw-r--r-- | lib/PublicInbox/ExtMsg.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 0138d373..0f3e392d 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -29,6 +29,10 @@ our @EXT_URL = map { ascii_html($_) } ( sub PARTIAL_MAX () { 100 } +sub mids_from_mset { # Search::retry_reopen callback + [ map { PublicInbox::SearchMsg::from_mitem($_)->mid } $_[0]->items ]; +} + sub search_partial ($$) { my ($srch, $mid) = @_; return if length($mid) < $MIN_PARTIAL_LEN; @@ -65,12 +69,8 @@ sub search_partial ($$) { # Search::Xapian::QueryParserError or even: # "something terrible happened at ../Search/Xapian/Enquire.pm" my $mset = eval { $srch->query($m, $opt) } or next; - - my @mids = map { - my $doc = $_->get_document; - PublicInbox::SearchMsg->load_doc($doc)->mid; - } $mset->items; - return \@mids if scalar(@mids); + my $mids = $srch->retry_reopen(\&mids_from_mset, $mset); + return $mids if scalar(@$mids); } } |