about summary refs log tree commit homepage
path: root/lib/PublicInbox/Search.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-04-25 21:31:45 +0000
committerEric Wong <e@80x24.org>2024-04-28 17:05:29 +0000
commitbad65d1197b8ee45a28e8bb7c894912145012fb5 (patch)
treea398e98f216d58691c05834ba5d2745ef0ec963a /lib/PublicInbox/Search.pm
parent25c5108f2bdb29009ac986b7bde29ffca24e6e7a (diff)
downloadpublic-inbox-bad65d1197b8ee45a28e8bb7c894912145012fb5.tar.gz
We need to be able to handle resource limitation errors in
public-facing daemons.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r--lib/PublicInbox/Search.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 60d12dbf..b7732ae5 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -469,8 +469,12 @@ sub async_mset {
         if ($XHC) { # unconditionally retrieving pct + rank for now
                 xdb($self); # populate {nshards}
                 my @margs = ($self->xh_args, xh_opt($opt));
-                my $rd = $XHC->mkreq(undef, 'mset', @margs, $qry_str);
-                PublicInbox::XhcMset->maybe_new($rd, $self, $cb, @args);
+                my $ret = eval {
+                        my $rd = $XHC->mkreq(undef, 'mset', @margs, $qry_str);
+                        PublicInbox::XhcMset->maybe_new($rd, $self, $cb, @args);
+                };
+                $cb->(@args, undef, $@) if $@;
+                $ret;
         } else { # synchronous
                 my $mset = $self->mset($qry_str, $opt);
                 $cb->(@args, $mset);