about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiImport.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-06-09 07:47:49 +0000
committerEric Wong <e@80x24.org>2021-06-09 10:03:44 +0000
commitac2cbae7af54527299dbfe927716ebc3c7ec89de (patch)
tree78632b5f1a346742ac5d0d136de2f7e2d9a2c6a2 /lib/PublicInbox/LeiImport.pm
parent9c3009655a0d365154f1119803465afc11713e79 (diff)
downloadpublic-inbox-ac2cbae7af54527299dbfe927716ebc3c7ec89de.tar.gz
Since Maildir isn't guaranteed to have any sort of order, we
can parallelize inputs, here.  On a 4-core system, this reduced
one of my tag invocations from 5.5 to 1.4s.
Diffstat (limited to 'lib/PublicInbox/LeiImport.pm')
-rw-r--r--lib/PublicInbox/LeiImport.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm
index cddd5619..e3cb69ca 100644
--- a/lib/PublicInbox/LeiImport.pm
+++ b/lib/PublicInbox/LeiImport.pm
@@ -35,13 +35,13 @@ sub pmdir_cb { # called via wq_io_do from LeiPmdir->each_mdir_fn
                 die "BUG: $f was not from a Maildir?\n";
         my $kw = PublicInbox::MdirReader::flags2kw($fl);
         substr($folder, 0, 0) = 'maildir:'; # add prefix
-        my $lms = $self->{-lms_ro};
+        my $lse = $self->{lse} //= $self->{lei}->{sto}->search;
+        my $lms = $self->{-lms_ro} //= $lse->lms; # may be 0 or undef
         my $oidbin = $lms ? $lms->name_oidbin($folder, $bn) : undef;
-        my @docids = defined($oidbin) ?
-                        $self->{over}->oidbin_exists($oidbin) : ();
+        my @docids = defined($oidbin) ? $lse->over->oidbin_exists($oidbin) : ();
         my $vmd = $self->{-import_kw} ? { kw => $kw } : undef;
         if (scalar @docids) {
-                $self->{lse}->kw_changed(undef, $kw, \@docids) or return;
+                $lse->kw_changed(undef, $kw, \@docids) or return;
         }
         if (my $eml = eml_from_path($f)) {
                 $vmd->{sync_info} = [ $folder, \$bn ] if $self->{-mail_sync};