]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiXSearch.pm
lei_xsearch: simplify lei/store import check
[public-inbox.git] / lib / PublicInbox / LeiXSearch.pm
index 2a037f2bd79b0af7b4f45051f37e90c1a282a888..41e798562d424b097ec611ef5f283f2251d9563b 100644 (file)
@@ -285,7 +285,7 @@ sub each_remote_eml { # callback for MboxReader->mboxrd
                my ($res, $kw) = $self->{import_sto}->wq_do('add_eml', $eml);
                if (ref($res) eq ref($smsg)) { # totally new message
                        $smsg = $res;
-                       $self->{-imported} = 1;
+                       $self->{-sto_imported} = 1;
                }
                $smsg->{kw} = $kw; # short-circuit xsmsg_vmd
        }
@@ -342,7 +342,7 @@ sub query_remote_mboxrd {
        local $SIG{TERM} = sub { exit(0) }; # for DESTROY (File::Temp, $reap)
        my $lei = $self->{lei};
        my $opt = $lei->{opt};
-       my $qstr = $lei->{mset_opt}->{qstr};
+       chomp(my $qstr = $lei->{mset_opt}->{qstr});
        $qstr =~ s/[ \n\t]+/ /sg; # make URLs less ugly
        my @qform = (x => 'm');
        push(@qform, t => 1) if $opt->{threads};
@@ -376,7 +376,7 @@ sub query_remote_mboxrd {
                $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
                PublicInbox::MboxReader->mboxrd($fh, \&each_remote_eml, $self,
                                                $lei, $each_smsg);
-               if ($self->{import_sto} && delete($self->{-imported})) {
+               if (delete($self->{-sto_imported})) {
                        my $wait = $self->{import_sto}->wq_do('done');
                }
                $reap_curl->join;
@@ -409,7 +409,10 @@ sub git { $_[0]->{git} // die 'BUG: git uninitialized' }
 sub xsearch_done_wait { # dwaitpid callback
        my ($arg, $pid) = @_;
        my ($wq, $lei) = @$arg;
-       $lei->child_error($?, 'non-fatal error from '.ref($wq)) if $?;
+       return if !$?;
+       my $s = $? & 127;
+       return $lei->child_error($?) if $s == 13 || $s == 15;
+       $lei->child_error($?, 'non-fatal error from '.ref($wq)." \$?=$?");
 }
 
 sub query_done { # EOF callback for main daemon