sub prep_ext { # externals_each callback
my ($lxs, $exclude, $loc) = @_;
sub prep_ext { # externals_each callback
my ($lxs, $exclude, $loc) = @_;
- my $auth = $self->{auth} = PublicInbox::LeiAuth->new($nwr);
- my $lxs = $self->{lxs};
- $auth->auth_start($self, $lxs->can('do_query'), $lxs, $self);
- } else {
- $self->{lxs}->do_query($self);
+ $self->{auth} = PublicInbox::LeiAuth->new
for my $loc (@{$opt->{include} // []}) {
my @loc = $self->get_externals($loc) or return;
$lxs->prepare_external($_) for @loc;
for my $loc (@{$opt->{include} // []}) {
my @loc = $self->get_externals($loc) or return;
$lxs->prepare_external($_) for @loc;
}
# --external is enabled by default, but allow --no-external
if ($opt->{external} //= 1) {
}
# --external is enabled by default, but allow --no-external
if ($opt->{external} //= 1) {
my $ne = $self->externals_each(\&prep_ext, $lxs, \%x);
$opt->{remote} //= !($lxs->locals - $opt->{'local'});
if ($opt->{'local'}) {
my $ne = $self->externals_each(\&prep_ext, $lxs, \%x);
$opt->{remote} //= !($lxs->locals - $opt->{'local'});
if ($opt->{'local'}) {
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");
}
$xj ||= $lxs->concurrency($opt); # allow: "--jobs ,$WRITER_ONLY"
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");
}
$xj ||= $lxs->concurrency($opt); # allow: "--jobs ,$WRITER_ONLY"
if (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) {
return $self->fail("`$mj' writer jobs must be >= 1");
}
if (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) {
return $self->fail("`$mj' writer jobs must be >= 1");
}
my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset);
$mset_opt{asc} = $opt->{'reverse'} ? 1 : 0;
my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset);
$mset_opt{asc} = $opt->{'reverse'} ? 1 : 0;