* [PATCH 05/12] lei lcat: use single queue for ordering
2021-09-21 7:41 6% [PATCH 00/12] lei: fix various annoyances Eric Wong
@ 2021-09-21 7:41 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-09-21 7:41 UTC (permalink / raw)
To: meta
If lcat-ing multiple argument types (blobs vs folders),
maintain the original order of the arguments instead of
dumping all blobs before folder contents.
---
lib/PublicInbox/LeiLcat.pm | 13 ++++++-------
lib/PublicInbox/LeiXSearch.pm | 16 ++++++++--------
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/lib/PublicInbox/LeiLcat.pm b/lib/PublicInbox/LeiLcat.pm
index ccb1823d..1a4a988e 100644
--- a/lib/PublicInbox/LeiLcat.pm
+++ b/lib/PublicInbox/LeiLcat.pm
@@ -21,7 +21,7 @@ sub lcat_folder ($$$) {
} else {
for my $f (@$folders) {
my $fid = $lms->fid_for($f);
- push @{$lei->{lcat_fid}}, $fid;
+ push @{$lei->{lcat_todo}}, { fid => $fid };
}
}
}
@@ -31,10 +31,9 @@ sub lcat_imap_uri ($$) {
my $lms = $lei->lms or return;
# cf. LeiXsearch->lcat_dump
if (defined $uri->uid) {
- my @oidhex = $lms->imap_oidhex($lei, $uri);
- push @{$lei->{lcat_blob}}, @oidhex;
+ push @{$lei->{lcat_todo}}, $lms->imap_oidhex($lei, $uri);
} elsif (defined(my $fid = $lms->fid_for($$uri))) {
- push @{$lei->{lcat_fid}}, $fid;
+ push @{$lei->{lcat_todo}}, { fid => $fid };
} else {
lcat_folder($lei, $lms, $$uri);
}
@@ -46,10 +45,10 @@ sub extract_1 ($$) {
my $u = $1;
require PublicInbox::URIimap;
lcat_imap_uri($lei, PublicInbox::URIimap->new($u));
- '""'; # blank query, using {lcat_blob} or {lcat_fid}
+ '""'; # blank query, using {lcat_todo}
} elsif ($x =~ m!\b(maildir:.+)!i) {
lcat_folder($lei, undef, $1);
- '""'; # blank query, using {lcat_blob} or {lcat_fid}
+ '""'; # blank query, using {lcat_todo}
} elsif ($x =~ m!\b([a-z]+?://\S+)!i) {
my $u = $1;
$u =~ s/[\>\]\)\,\.\;]+\z//;
@@ -82,7 +81,7 @@ sub extract_1 ($$) {
} elsif ($x =~ /\bid:(\S+)/) { # notmuch convention
"mid:$1";
} elsif ($x =~ /\bblob:([0-9a-f]{7,})\b/) {
- push @{$lei->{lcat_blob}}, $1; # cf. LeiToMail->wq_atexit_child
+ push @{$lei->{lcat_todo}}, $1; # cf. LeiToMail->wq_atexit_child
'""'; # blank query
} else {
undef;
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 756183a9..3ce8f32d 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -570,7 +570,7 @@ sub do_query {
@$end = ();
$self->{opt_threads} = $lei->{opt}->{threads};
$self->{opt_sort} = $lei->{opt}->{'sort'};
- $self->{-do_lcat} = $lei->{lcat_blob} // $lei->{lcat_fid};
+ $self->{-do_lcat} = !!(delete $lei->{lcat_todo});
if ($l2m) {
$l2m->net_merge_all_done unless $lei->{auth};
} else {
@@ -646,13 +646,13 @@ sub lcat_dump { # via wq_io_do
$git->cat_async($smsg->{blob}, \&_lcat2smsg, $smsg);
};
}
- for my $oid (@{$lei->{lcat_blob} // []}) {
- $each_smsg->({ blob => $oid, pct => 100 });
- }
- if (my $fids = delete $lei->{lcat_fid}) {
- my $lms = $lei->{lse}->lms;
- for my $fid (@$fids) {
- $lms->each_src({fid => $fid}, \&_lcat_i, $each_smsg);
+ my $lms;
+ for my $ent (@{$lei->{lcat_todo}}) {
+ if (ref $ent eq 'HASH') { # { fid => $fid ,.. }
+ $lms //= $lei->{lse}->lms;
+ $lms->each_src($ent, \&_lcat_i, $each_smsg);
+ } else { # oidhex
+ $each_smsg->({ blob => $ent, pct => 100 });
}
}
$git->async_wait_all;
^ permalink raw reply related [relevance 7%]
* [PATCH 00/12] lei: fix various annoyances
@ 2021-09-21 7:41 6% Eric Wong
2021-09-21 7:41 7% ` [PATCH 05/12] lei lcat: use single queue for ordering Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-09-21 7:41 UTC (permalink / raw)
To: meta
Eric Wong (12):
lei inspect: convert to WQ worker
lei inspect: support NNTP URLs
lei_mail_sync: account for non-unique cases
lei: simplify internal arg2folder usage
lei lcat: use single queue for ordering
doc: lei-security: section for WIP auth methods
lei lcat: support NNTP URLs
lei: various completion improvements
lei q: show progress on >1s preparation phase
search: drop reopen retry message
lei q: update messages to reflect --save default
lei q: improve --limit behavior and progress
Documentation/lei-q.pod | 6 +-
Documentation/lei-security.pod | 8 ++
lib/PublicInbox/LEI.pm | 2 +-
lib/PublicInbox/LeiExportKw.pm | 12 +--
lib/PublicInbox/LeiExternal.pm | 5 ++
lib/PublicInbox/LeiForgetMailSync.pm | 9 +--
lib/PublicInbox/LeiImport.pm | 20 +++--
lib/PublicInbox/LeiImportKw.pm | 12 ++-
lib/PublicInbox/LeiInspect.pm | 103 +++++++++++++++++---------
lib/PublicInbox/LeiLcat.pm | 91 +++++++++++++----------
lib/PublicInbox/LeiLsMailSource.pm | 11 +--
lib/PublicInbox/LeiMailSync.pm | 102 +++++++++++++++++--------
lib/PublicInbox/LeiNoteEvent.pm | 5 +-
lib/PublicInbox/LeiQuery.pm | 9 ++-
lib/PublicInbox/LeiRefreshMailSync.pm | 18 +++--
lib/PublicInbox/LeiSavedSearch.pm | 22 +++---
lib/PublicInbox/LeiTag.pm | 14 ++--
lib/PublicInbox/LeiToMail.pm | 23 +++++-
lib/PublicInbox/LeiUp.pm | 25 +++----
lib/PublicInbox/LeiXSearch.pm | 36 ++++++---
lib/PublicInbox/Search.pm | 1 -
lib/PublicInbox/SharedKV.pm | 19 +++--
lib/PublicInbox/TestCommon.pm | 11 ++-
t/lei-import-nntp.t | 44 +++++++++++
t/lei-q-save.t | 6 +-
t/lei-watch.t | 2 +-
26 files changed, 414 insertions(+), 202 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-21 7:41 6% [PATCH 00/12] lei: fix various annoyances Eric Wong
2021-09-21 7:41 7% ` [PATCH 05/12] lei lcat: use single queue for ordering Eric Wong
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).