about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTP.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r--lib/PublicInbox/HTTP.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index fcbd758a..6df1c3fc 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -265,10 +265,13 @@ sub getline_response {
         my $pull = $self->{pull} = sub {
                 local $/ = \8192;
                 my $forward = $self->{forward};
+                # limit our own running time for fairness with other
+                # clients and to avoid buffering too much:
+                my $n = 100;
                 while ($forward && defined(my $buf = $forward->getline)) {
                         $write->($buf);
                         last if $self->{closed};
-                        if ($self->{write_buf_size}) {
+                        if ((--$n) <= 0 || $self->{write_buf_size}) {
                                 $self->write($self->{pull});
                                 return;
                         }