From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/5] search: async_mset: pass resource errors to callback
Date: Thu, 25 Apr 2024 21:31:45 +0000 [thread overview]
Message-ID: <20240425213146.1166555-5-e@80x24.org> (raw)
In-Reply-To: <20240425213146.1166555-1-e@80x24.org>
We need to be able to handle resource limitation errors in
public-facing daemons.
---
lib/PublicInbox/Search.pm | 8 ++++++--
1 file 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);
next prev parent reply other threads:[~2024-04-25 21:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 21:31 [PATCH 0/5] xap_helper stuff for public daemons Eric Wong
2024-04-25 21:31 ` [PATCH 1/5] t/cindex: require DBD::SQLite for now Eric Wong
2024-04-25 21:31 ` [PATCH 2/5] www: mbox*: use Perl 5.12 Eric Wong
2024-04-25 21:31 ` [PATCH 3/5] send_cmd4: make `tries' a per-call parameter Eric Wong
2024-04-25 21:31 ` Eric Wong [this message]
2024-04-25 21:31 ` [PATCH 5/5] daemon: share and allow configuring Xapian helpers Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240425213146.1166555-5-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).