about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-21 11:11:09 +0000
committerEric Wong <e@80x24.org>2015-09-21 11:37:03 +0000
commitf9d88ea6c375f6f265da1a13025abcc9e38d6839 (patch)
treedfc549c5b415047bbc736d0d51c13c2dd248e6b6 /lib/PublicInbox/NNTP.pm
parente2c72e2671d395cbc3fff9cad5c8da4e08367e26 (diff)
downloadpublic-inbox-f9d88ea6c375f6f265da1a13025abcc9e38d6839.tar.gz
Reserializing the message to a string to check size wastes
considerable time and should be able to get by with slightly
less accuracy.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index d5eb4971..fb93330b 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -366,7 +366,8 @@ find_mid:
         }
 found:
         my $o = 'HEAD:' . mid2path($mid);
-        my $s = eval { Email::Simple->new($ng->gcf->cat_file($o)) };
+        my $bytes;
+        my $s = eval { Email::Simple->new($ng->gcf->cat_file($o, \$bytes)) };
         return $err unless $s;
         if ($set_headers) {
                 $s->header_set('Newsgroups', $ng->{name});
@@ -375,7 +376,7 @@ found:
 
                 # must be last
                 if ($set_headers == 2) {
-                        $s->header_set('Bytes', bytes::length($s->as_string));
+                        $s->header_set('Bytes', $bytes);
                         $s->body_set('');
                 }
         }