]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchIdxShard.pm
favor readline() and print() as functions
[public-inbox.git] / lib / PublicInbox / SearchIdxShard.pm
index 06bcd4035a1fe43cf81a34fc8fca768050612a8b..c1f52d8b884fd7e723275f8e8c259aaf2ace4092 100644 (file)
@@ -8,6 +8,7 @@ use strict;
 use warnings;
 use base qw(PublicInbox::SearchIdx);
 use IO::Handle (); # autoflush
+use PublicInbox::Eml;
 
 sub new {
        my ($class, $v2writable, $shard) = @_;
@@ -52,7 +53,7 @@ sub shard_worker_loop ($$$$$) {
        my ($self, $v2w, $r, $shard, $bnote) = @_;
        $0 = "pi-v2-shard[$shard]";
        $self->begin_txn_lazy;
-       while (my $line = $r->getline) {
+       while (my $line = readline($r)) {
                $v2w->{current_info} = "[$shard] $line";
                if ($line eq "commit\n") {
                        $self->commit_txn_lazy;
@@ -75,7 +76,7 @@ sub shard_worker_loop ($$$$$) {
                        $self->begin_txn_lazy;
                        my $n = read($r, my $msg, $bytes) or die "read: $!\n";
                        $n == $bytes or die "short read: $n != $bytes\n";
-                       my $mime = PublicInbox::MIME->new(\$msg);
+                       my $mime = PublicInbox::Eml->new(\$msg);
                        my $smsg = bless {
                                bytes => $bytes,
                                num => $num + 0,