From: Eric Wong Date: Thu, 25 Apr 2024 21:31:45 +0000 (+0000) Subject: search: async_mset: pass resource errors to callback X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bad65d1197b8ee45a28e8bb7c894912145012fb5;p=thirdparty%2Fpublic-inbox.git search: async_mset: pass resource errors to callback We need to be able to handle resource limitation errors in public-facing daemons. --- diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 60d12dbf2..b7732ae57 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);