From 95ae3c4a45435a8208a8f10b27c78329b5ad3e85 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 19 Oct 2021 09:33:38 +0000 Subject: lei: use die for external and query handling This allows "lei up" to continue processing unrelated externals if on output fails. --- lib/PublicInbox/LeiQuery.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/PublicInbox/LeiQuery.pm') diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index ec2ece05..56b82acc 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -18,17 +18,15 @@ sub _start_query { # used by "lei q" and "lei up" PublicInbox::LeiOverview->new($self) or return; my $opt = $self->{opt}; my ($xj, $mj) = split(/,/, $opt->{jobs} // ''); - if (defined($xj) && $xj ne '' && $xj !~ /\A[1-9][0-9]*\z/) { - return $self->fail("`$xj' search jobs must be >= 1"); - } + (defined($xj) && $xj ne '' && $xj !~ /\A[1-9][0-9]*\z/) and + die "`$xj' search jobs must be >= 1\n"; my $lxs = $self->{lxs}; $xj ||= $lxs->concurrency($opt); # allow: "--jobs ,$WRITER_ONLY" my $nproc = $lxs->detect_nproc || 1; # don't memoize, schedtool(1) exists $xj = $nproc if $xj > $nproc; $lxs->{-wq_nr_workers} = $xj; - if (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) { - return $self->fail("`$mj' writer jobs must be >= 1"); - } + (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) and + die "`$mj' writer jobs must be >= 1\n"; my $l2m = $self->{l2m}; # we use \1 (a ref) to distinguish between default vs. user-supplied if ($l2m && grep { $opt->{$_} //= \1 } (qw(mail-sync import-remote @@ -112,7 +110,7 @@ sub lxs_prepare { } } ($lxs->locals || $lxs->remotes) ? ($self->{lxs} = $lxs) : - $self->fail('no local or remote inboxes to search'); + die("no local or remote inboxes to search\n"); } # the main "lei q SEARCH_TERMS" method -- cgit v1.2.3-24-ge0c7