about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-14 13:12:00 +0200
committerEric Wong <e@80x24.org>2021-03-15 08:04:44 +0000
commit42fc590f8cabd23455949d002e2ddf28bbec6d1e (patch)
treecf521b1325e9d74d60ad5f75d0df1d12cf277cb0 /lib/PublicInbox/LeiXSearch.pm
parent64b557420689476493d752968d99ab8ae62bad9a (diff)
downloadpublic-inbox-42fc590f8cabd23455949d002e2ddf28bbec6d1e.tar.gz
We only want to auto import messages that are exclusively in
remote externals.  Messages in local externals are not
auto-imported to save space and reduce wear on storage device.
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index f2c8c02e..22c8026c 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -97,6 +97,11 @@ sub recent {
 
 sub over {}
 
+sub overs_all { # for xids_for
+        my ($self) = @_;
+        grep(defined, map { $_->over } locals($self))
+}
+
 sub _mset_more ($$) {
         my ($mset, $mo) = @_;
         my $size = $mset->size;
@@ -204,7 +209,9 @@ sub query_mset { # non-parallel for non-"--threads" users
 
 sub each_remote_eml { # callback for MboxReader->mboxrd
         my ($eml, $self, $lei, $each_smsg) = @_;
-        $lei->{sto}->ipc_do('add_eml', $eml) if $lei->{opt}->{'import-remote'};
+        if (my $sto = $self->{import_sto}) {
+                $sto->ipc_do('add_eml_maybe', $eml);
+        }
         my $smsg = bless {}, 'PublicInbox::Smsg';
         $smsg->populate($eml);
         $smsg->parse_references($eml, mids($eml));
@@ -249,6 +256,7 @@ sub query_remote_mboxrd {
         my $curl = PublicInbox::LeiCurl->new($lei, $self->{curl}) or return;
         push @$curl, '-s', '-d', '';
         my $each_smsg = $lei->{ovv}->ovv_each_smsg_cb($lei);
+        $self->{import_sto} = $lei->{sto} if $lei->{opt}->{'import-remote'};
         for my $uri (@$uris) {
                 $lei->{-current_url} = $uri->as_string;
                 $lei->{-nr_remote_eml} = 0;