]> Sergey Matveev's repositories - public-inbox.git/commitdiff
index: allow specifying --jobs=0 to disable multiprocess
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Sat, 7 Apr 2018 03:41:51 +0000 (03:41 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Sat, 7 Apr 2018 03:42:28 +0000 (03:42 +0000)
Not everybody needs multiprocess support.

script/public-inbox-index

index 73f88ac6bee72fd0eabc3497881cf42e3392cc97..db7ebbab6421ec2cc1b849e4259b2ac82d6d745b 100755 (executable)
@@ -31,7 +31,7 @@ my %opts = (
        '--prune' => \$prune,
 );
 GetOptions(%opts) or die "bad command-line args\n$usage";
-die "--jobs must be positive\n" if defined $jobs && $jobs <= 0;
+die "--jobs must be positive\n" if defined $jobs && $jobs < 0;
 
 my @dirs;
 
@@ -101,11 +101,11 @@ sub index_dir {
                eval { require PublicInbox::V2Writable };
                die "v2 requirements not met: $@\n" if $@;
                my $v2w = eval {
-                       local $ENV{NPROC} = $jobs;
+                       local $ENV{NPROC} = $jobs if $jobs;
                        PublicInbox::V2Writable->new($repo);
                };
                if (defined $jobs) {
-                       if ($jobs == 1) {
+                       if ($jobs == 0) {
                                $v2w->{parallel} = 0;
                        } else {
                                my $n = $v2w->{partitions};