about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-21 07:41:32 +0000
committerEric Wong <e@80x24.org>2021-02-21 08:59:32 +0000
commit707d4aca2256f284718c247ef00db64cd976d244 (patch)
treedc3b7100b6a50e0df55528fd7875af28d4f66b5a /lib/PublicInbox/LeiQuery.pm
parent07bb4d74f25b0c2c14a8762905087be5a0f7e934 (diff)
downloadpublic-inbox-707d4aca2256f284718c247ef00db64cd976d244.tar.gz
We can use this to ensure sharded work doesn't do unexpected
things if workers are added/removed.  We currently don't
increase/decrease workers once a workqueue is started, but
non-lei code (-httpd/imapd) may start doing so.

This also fixes a bug where lei2mail workers could not
be adjusted via --jobs on the command-line.
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index eaf91f2e..398f834f 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -90,14 +90,14 @@ sub lei_q {
                 return $self->fail("`$xj' search jobs must be >= 1");
         }
         $xj ||= $lxs->concurrency($opt); # allow: "--jobs ,$WRITER_ONLY"
-        my $nproc = $lxs->detect_nproc; # don't memoize, schedtool(1) exists
+        my $nproc = $lxs->detect_nproc // 1; # don't memoize, schedtool(1) exists
         $xj = $nproc if $xj > $nproc;
-        $lxs->{jobs} = $xj;
+        $lxs->{-wq_nr_workers} = $xj;
         if (defined($mj) && $mj !~ /\A[1-9][0-9]*\z/) {
                 return $self->fail("`$mj' writer jobs must be >= 1");
         }
-        $self->{l2m}->{jobs} = ($mj // $nproc) if $self->{l2m};
         PublicInbox::LeiOverview->new($self) or return;
+        $self->{l2m}->{-wq_nr_workers} = ($mj // $nproc) if $self->{l2m};
 
         my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset);
         $mset_opt{asc} = $opt->{'reverse'} ? 1 : 0;