]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiQuery.pm
lei: improve management around short-lived workers
[public-inbox.git] / lib / PublicInbox / LeiQuery.pm
index 532668aebf4a71d4480bbc222b3bc906a7eeb046..84996e7e2f4b4e3d8985917f224eb56a67824eff 100644 (file)
@@ -50,11 +50,11 @@ sub lei_q {
        # --local is enabled by default unless --only is used
        # we'll allow "--only $LOCATION --local"
        my $sto = $self->_lei_store(1);
-       my $lse = $sto->search;
        if (($opt->{'import-remote'} //= 1) |
                        (($opt->{'import-before'} //= \1) ? 1 : 0)) {
                $sto->write_prepare($self);
        }
+       my $lse = $sto->search;
        if ($opt->{'local'} //= scalar(@only) ? 0 : 1) {
                $lxs->prepare_external($lse);
        }
@@ -90,6 +90,7 @@ sub lei_q {
        unless ($lxs->locals || $lxs->remotes) {
                return $self->fail('no local or remote inboxes to search');
        }
+       $self->ale->refresh_externals($lxs);
        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");