]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiRemote.pm
get rid of unnecessary bytes::length usage
[public-inbox.git] / lib / PublicInbox / LeiRemote.pm
index 399fc9362c4792521b143bba5c3c64a1b0b3f45c..580787c042c4e317d7c79ddab425c05b0816d2f3 100644 (file)
@@ -26,12 +26,13 @@ sub _each_mboxrd_eml { # callback for MboxReader->mboxrd
        my ($eml, $self) = @_;
        my $lei = $self->{lei};
        my $xoids = $lei->{ale}->xoids_for($eml, 1);
+       my $smsg = bless {}, 'PublicInbox::Smsg';
        if ($lei->{sto} && !$xoids) { # memoize locally
-               $lei->{sto}->ipc_do('add_eml', $eml);
+               my $res = $lei->{sto}->ipc_do('add_eml', $eml);
+               $smsg = $res if ref($res) eq ref($smsg);
        }
-       my $smsg = bless {}, 'PublicInbox::Smsg';
-       $smsg->{blob} = $xoids ? (keys(%$xoids))[0]
-                               : git_sha(1, $eml)->hexdigest;
+       $smsg->{blob} //= $xoids ? (keys(%$xoids))[0]
+                               : $lei->git_blob_id($eml);
        $smsg->populate($eml);
        $smsg->{mid} //= '(none)';
        push @{$self->{smsg}}, $smsg;
@@ -50,7 +51,7 @@ sub mset {
        my ($fh, $pid) = popen_rd($cmd, undef, $rdr);
        my $reap = PublicInbox::OnDestroy->new($lei->can('sigint_reap'), $pid);
        $self->{smsg} = [];
-       $fh = IO::Uncompress::Gunzip->new($fh);
+       $fh = IO::Uncompress::Gunzip->new($fh, MultiStream => 1);
        PublicInbox::MboxReader->mboxrd($fh, \&_each_mboxrd_eml, $self);
        my $err = waitpid($pid, 0) == $pid ? undef
                                        : "BUG: waitpid($cmd): $!";