about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-18 09:33:24 +0000
committerEric Wong <e@80x24.org>2021-09-18 20:25:25 +0000
commit7b7939d47b336fb7d8c4387858e620dbc218bb1e (patch)
treee10c335f3856348351fa7d5c84598625698aa6fc /lib
parent63807b9322151773d746303041c84dc37701bac2 (diff)
downloadpublic-inbox-7b7939d47b336fb7d8c4387858e620dbc218bb1e.tar.gz
It doesn't seem worthwhile to change worker counts dynamically
on a per-command-basis with lei, and I don't know how such an
interface would even work...
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LEI.pm3
-rw-r--r--lib/PublicInbox/LeiExportKw.pm1
-rw-r--r--lib/PublicInbox/LeiImport.pm1
-rw-r--r--lib/PublicInbox/LeiLsMailSource.pm3
-rw-r--r--lib/PublicInbox/LeiLsSearch.pm2
-rw-r--r--lib/PublicInbox/LeiRefreshMailSync.pm4
-rw-r--r--lib/PublicInbox/LeiRm.pm2
-rw-r--r--lib/PublicInbox/LeiTag.pm3
8 files changed, 7 insertions, 12 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 9794497b..41e761f8 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -258,7 +258,7 @@ our %CMD = ( # sorted in order of importance/use:
          @c_opt ],
 'import' => [ 'LOCATION...|--stdin',
         'one-time import/update from URL or filesystem',
-        qw(stdin| offset=i recursive|r exclude=s include|I=s jobs=s new-only
+        qw(stdin| offset=i recursive|r exclude=s include|I=s new-only
         lock=s@ in-format|F=s kw! verbose|v+ incremental! mail-sync!),
         @net_opt, @c_opt ],
 'forget-mail-sync' => [ 'LOCATION...',
@@ -627,6 +627,7 @@ sub workers_start {
         my $end = $lei->pkt_op_pair;
         my $ident = $wq->{-wq_ident} // "lei-$lei->{cmd} worker";
         $flds->{lei} = $lei;
+        $wq->{-wq_nr_workers} //= $jobs; # lock, no incrementing
         $wq->wq_workers_start($ident, $jobs, $lei->oldset, $flds);
         delete $lei->{pkt_op_p};
         my $op_c = delete $lei->{pkt_op_c};
diff --git a/lib/PublicInbox/LeiExportKw.pm b/lib/PublicInbox/LeiExportKw.pm
index d37f3768..8b8aa373 100644
--- a/lib/PublicInbox/LeiExportKw.pm
+++ b/lib/PublicInbox/LeiExportKw.pm
@@ -124,7 +124,6 @@ EOM
         my $ops = {};
         $sto->write_prepare($lei);
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
-        $self->{-wq_nr_workers} = $j // 1; # locked
         (my $op_c, $ops) = $lei->workers_start($self, $j, $ops);
         $lei->{wq1} = $self;
         $lei->{-err_type} = 'non-fatal';
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm
index 7c563bd8..b1cb3940 100644
--- a/lib/PublicInbox/LeiImport.pm
+++ b/lib/PublicInbox/LeiImport.pm
@@ -101,7 +101,6 @@ sub do_import_index ($$@) {
         }
         my $ops = {};
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
-        $self->{-wq_nr_workers} = $j // 1; # locked
         $lei->{-eml_noisy} = 1;
         (my $op_c, $ops) = $lei->workers_start($self, $j, $ops);
         $lei->{wq1} = $self;
diff --git a/lib/PublicInbox/LeiLsMailSource.pm b/lib/PublicInbox/LeiLsMailSource.pm
index f012e10e..bcb1838e 100644
--- a/lib/PublicInbox/LeiLsMailSource.pm
+++ b/lib/PublicInbox/LeiLsMailSource.pm
@@ -96,8 +96,7 @@ sub lei_ls_mail_source {
         $lei->start_pager if -t $lei->{1};
         my $ops = {};
         $lei->{auth}->op_merge($ops, $self);
-        my $j = $self->{-wq_nr_workers} = 1; # locked
-        (my $op_c, $ops) = $lei->workers_start($self, $j, $ops);
+        (my $op_c, $ops) = $lei->workers_start($self, 1, $ops);
         $lei->{wq1} = $self;
         $lei->{-err_type} = 'non-fatal';
         net_merge_all_done($self) unless $lei->{auth};
diff --git a/lib/PublicInbox/LeiLsSearch.pm b/lib/PublicInbox/LeiLsSearch.pm
index 70136135..aebf0184 100644
--- a/lib/PublicInbox/LeiLsSearch.pm
+++ b/lib/PublicInbox/LeiLsSearch.pm
@@ -71,7 +71,7 @@ sub do_ls_search_long {
 
 sub bg_worker ($$$) {
         my ($lei, $pfx, $json) = @_;
-        my $self = bless { -wq_nr_workers => 1, json => $json }, __PACKAGE__;
+        my $self = bless { json => $json }, __PACKAGE__;
         my ($op_c, $ops) = $lei->workers_start($self, 1);
         $lei->{wq1} = $self;
         $self->wq_io_do('do_ls_search_long', [], $pfx);
diff --git a/lib/PublicInbox/LeiRefreshMailSync.pm b/lib/PublicInbox/LeiRefreshMailSync.pm
index 09a7ead0..cdd99725 100644
--- a/lib/PublicInbox/LeiRefreshMailSync.pm
+++ b/lib/PublicInbox/LeiRefreshMailSync.pm
@@ -84,11 +84,9 @@ EOM
         my $self = bless { missing_ok => 1 }, __PACKAGE__;
         $lei->{opt}->{'mail-sync'} = 1; # for prepare_inputs
         $self->prepare_inputs($lei, \@folders) or return;
-        my $j = $lei->{opt}->{jobs} || scalar(@{$self->{inputs}}) || 1;
         my $ops = {};
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
-        $self->{-wq_nr_workers} = $j // 1; # locked
-        (my $op_c, $ops) = $lei->workers_start($self, $j, $ops);
+        (my $op_c, $ops) = $lei->workers_start($self, 1, $ops);
         $lei->{wq1} = $self;
         $lei->{-err_type} = 'non-fatal';
         net_merge_all_done($self) unless $lei->{auth};
diff --git a/lib/PublicInbox/LeiRm.pm b/lib/PublicInbox/LeiRm.pm
index 778fa1de..3371f3ed 100644
--- a/lib/PublicInbox/LeiRm.pm
+++ b/lib/PublicInbox/LeiRm.pm
@@ -32,7 +32,7 @@ sub lei_rm {
         my ($lei, @inputs) = @_;
         $lei->_lei_store(1)->write_prepare($lei);
         $lei->{opt}->{'in-format'} //= 'eml';
-        my $self = bless { -wq_nr_workers => 1 }, __PACKAGE__;
+        my $self = bless {}, __PACKAGE__;
         $self->prepare_inputs($lei, \@inputs) or return;
         my ($op_c, $ops) = $lei->workers_start($self, 1);
         $lei->{wq1} = $self;
diff --git a/lib/PublicInbox/LeiTag.pm b/lib/PublicInbox/LeiTag.pm
index 44d77b88..c4f5ecff 100644
--- a/lib/PublicInbox/LeiTag.pm
+++ b/lib/PublicInbox/LeiTag.pm
@@ -50,8 +50,7 @@ sub lei_tag { # the "lei tag" method
                 return $lei->fail('no keywords or labels specified');
         my $ops = {};
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
-        my $j = $self->{-wq_nr_workers} = 1; # locked for now
-        (my $op_c, $ops) = $lei->workers_start($self, $j, $ops);
+        (my $op_c, $ops) = $lei->workers_start($self, 1, $ops);
         $lei->{wq1} = $self;
         $lei->{-err_type} = 'non-fatal';
         net_merge_all_done($self) unless $lei->{auth};