From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20210403022427.2430-4-e@80x24.org> (raw)
In-Reply-To: <20210403022427.2430-1-e@80x24.org>
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;
next prev parent reply other threads:[~2021-04-03 2:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 2:24 [PATCH 0/6] lei auth-related fixes Eric Wong
2021-04-03 2:24 ` [PATCH 1/6] URInntps: add URI 5.08 release note Eric Wong
2021-04-03 2:24 ` [PATCH 2/6] lei q: ensure wq workers shutdown on IMAP auth failures Eric Wong
2021-04-03 2:24 ` Eric Wong [this message]
2021-04-03 2:24 ` [PATCH 4/6] lei_auth: rename {net_merge} to {net_merge_continue} Eric Wong
2021-04-03 2:24 ` [PATCH 5/6] net_reader: fix read-only "lei convert" auth failures Eric Wong
2021-04-03 2:24 ` [PATCH 6/6] xt/lei-auth-fail: test more failure cases Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210403022427.2430-4-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).