]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_to_mail: limit workers for text, reply and v2 outputs
authorEric Wong <e@80x24.org>
Sat, 30 Oct 2021 08:11:41 +0000 (08:11 +0000)
committerEric Wong <e@80x24.org>
Sat, 30 Oct 2021 18:34:32 +0000 (18:34 +0000)
"text" and "reply" outputs are intended for the pager, so
parallelizing them is a waste of resources.

v2 has shards, of course, so parallelizing writes to it
is also a waste since the deduplication work is a bit
more complex.

lib/PublicInbox/LeiQuery.pm
lib/PublicInbox/LeiToMail.pm

index 3d0e5b144d3a9c939cc036e525283adc020c8a2c..352ee60131aaf6bc9baabfbd4ae735c4a0f06568 100644 (file)
@@ -37,7 +37,7 @@ sub _start_query { # used by "lei q" and "lei up"
                        $lms->lms_write_prepare->lms_pause; # just create
                }
        }
-       $l2m and $l2m->{-wq_nr_workers} = $mj //
+       $l2m and $l2m->{-wq_nr_workers} //= $mj //
                int($nproc * 0.75 + 0.5); # keep some CPU for git
 
        # descending docid order is cheapest, MUA controls sorting order
index 83f58a29405b4b490d1037c1d8d311742546c943..90db30e53089942be3c512033e23f17147089e39 100644 (file)
@@ -415,11 +415,13 @@ sub new {
                require PublicInbox::LeiViewText;
                $lei->{lvt} = PublicInbox::LeiViewText->new($lei, $fmt);
                $self->{base_type} = 'text';
+               $self->{-wq_nr_workers} = 1; # for pager
                @conflict = qw(mua save);
        } elsif ($fmt eq 'v2') {
                die "--dedupe=oid and v2 are incompatible\n" if
                        ($lei->{opt}->{dedupe}//'') eq 'oid';
                $self->{base_type} = 'v2';
+               $self->{-wq_nr_workers} = 1; # v2 has shards
                $lei->{opt}->{save} = \1;
                $dst = $lei->{ovv}->{dst} = $lei->abs_path($dst);
                @conflict = qw(mua sort);