]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiToMail.pm
lei_to_mail: limit workers for text, reply and v2 outputs
[public-inbox.git] / lib / PublicInbox / LeiToMail.pm
index e7220bf02954f3c7c5382e42f7d0f35e6e7df266..90db30e53089942be3c512033e23f17147089e39 100644 (file)
@@ -282,6 +282,7 @@ sub _maildir_write_cb ($$) {
        my $lse = $lei->{lse}; # may be undef
        my $lms = $self->{-lms_rw};
        my $out = $lms ? 'maildir:'.$lei->abs_path($dst) : undef;
+       $lms->lms_write_prepare if $lms;
 
        # Favor cur/ and only write to new/ when augmenting.  This
        # saves MUAs from having to do a mass rename when the initial
@@ -312,6 +313,7 @@ sub _imap_write_cb ($$) {
        $uri->uidvalidity($mic->uidvalidity($folder));
        my $lse = $lei->{lse}; # may be undef
        my $lms = $self->{-lms_rw};
+       $lms->lms_write_prepare if $lms;
        sub { # for git_to_mail
                my ($bref, $smsg, $eml) = @_;
                $mic // return $lei->fail; # mic may be undef-ed in last run
@@ -413,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);
@@ -750,7 +754,6 @@ sub ipc_atfork_child {
        my ($self) = @_;
        my $lei = $self->{lei};
        $lei->_lei_atfork_child;
-       $self->{-lms_rw}->lms_write_prepare if $self->{-lms_rw};
        $lei->{auth}->do_auth_atfork($self) if $lei->{auth};
        $SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb();
        $self->SUPER::ipc_atfork_child;