From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E5BF31F9F2 for ; Sat, 3 Apr 2021 02:24:27 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/6] lei tag: fix tagging of IMAP inputs Date: Sat, 3 Apr 2021 02:24:24 +0000 Message-Id: <20210403022427.2430-4-e@80x24.org> In-Reply-To: <20210403022427.2430-1-e@80x24.org> References: <20210403022427.2430-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We need net_merge_all and to lock the number of worker jobs. Parallel inputs are not supported, yet (is it needed?, I don't expect this to be used for multiple files very often...). --- lib/PublicInbox/LeiTag.pm | 6 +++++- t/lei-import-imap.t | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/LeiTag.pm b/lib/PublicInbox/LeiTag.pm index d572a84a..06313139 100644 --- a/lib/PublicInbox/LeiTag.pm +++ b/lib/PublicInbox/LeiTag.pm @@ -112,7 +112,8 @@ sub lei_tag { # the "lei tag" method my $ops = { '' => [ \&tag_done, $lei ] }; $lei->{auth}->op_merge($ops, $self) if $lei->{auth}; $self->{vmd_mod} = $vmd_mod; - (my $op_c, $ops) = $lei->workers_start($self, 'lei_tag', 1, $ops); + my $j = $self->{-wq_nr_workers} = 1; # locked for now + (my $op_c, $ops) = $lei->workers_start($self, 'lei_tag', $j, $ops); $lei->{tag} = $self; net_merge_complete($self) unless $lei->{auth}; $op_c->op_wait_event($ops); @@ -175,4 +176,7 @@ sub _complete_tag { } grep(/$re\Q$cur/, @all); } +no warnings 'once'; # the following works even when LeiAuth is lazy-loaded +*net_merge_all = \&PublicInbox::LeiAuth::net_merge_all; + 1; diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t index fd38037a..7e4d44b9 100644 --- a/t/lei-import-imap.t +++ b/t/lei-import-imap.t @@ -23,5 +23,6 @@ test_lei({ tmpdir => $tmpdir }, sub { my %r; for (@$out) { $r{ref($_)}++ } is_deeply(\%r, { 'HASH' => scalar(@$out) }, 'all hashes'); + lei_ok([qw(tag +kw:seen), "imap://$host_port/t.v2.0"], undef, undef); }); done_testing;