]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mbox: be fair to other HTTP clients
authorEric Wong <e@80x24.org>
Sat, 6 Aug 2016 01:58:47 +0000 (01:58 +0000)
committerEric Wong <e@80x24.org>
Sat, 6 Aug 2016 02:03:36 +0000 (02:03 +0000)
At least for public-inbox-httpd, this allows us to avoid having
a client monopolize one event loop tick of the server for too
long.  It hurts throughput for the /all.mbox.gz endpoint, but I
doubt anybody cares and the latency improvement for other
clients would be appreciated.

We already do the same fairness thing for HTML pages.

lib/PublicInbox/Mbox.pm

index 1e3de5b0d484550b940ce977ff27f8d015ed757e..dc41548b87ce68726dc41aa79bd571589a150641 100644 (file)
@@ -138,6 +138,9 @@ sub getline {
                                ${$self->{buf}} = '';
                                return $ret;
                        }
+
+                       # be fair to other clients on public-inbox-httpd:
+                       return '';
                }
                $res = $self->{cb}->($self->{opts});
                $self->{msgs} = $res->{msgs};