diff options
author | Eric Wong <e@80x24.org> | 2021-09-28 07:53:49 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-28 20:23:53 +0000 |
commit | 205599c0814e1031760e54cce9d8880e747cbb08 (patch) | |
tree | 5bda9afd681100d640288236e143e7ca215276b2 /lib/PublicInbox/WWW.pm | |
parent | 3dbd6dc31dd7e34bea87dbb626f811e093b6860b (diff) | |
download | public-inbox-205599c0814e1031760e54cce9d8880e747cbb08.tar.gz |
While each git blob request is treated fairly w.r.t other git blob requests, responses triggering thousands of git blob requests can still noticeably increase latency for less-expensive responses. Move large mbox results and the nasty all.mbox endpoint to a low priority queue which only fires once per-event loop iteration. This reduces the response time of short HTTP responses while many gigantic mboxes are being downloaded simultaneously, but still maximizes use of available I/O when there's no inexpensive HTTP responses happening. This only affects PublicInbox::WWW users who use public-inbox-httpd, not generic PSGI servers.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 570e690e..a7c961f4 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -659,4 +659,13 @@ sub get_description { }; } +sub event_step { # called via requeue + my ($self) = @_; + # gzf = PublicInbox::GzipFilter == $ctx + my $gzf = shift(@{$self->{-low_prio_q}}) // return; + PublicInbox::DS::requeue($self) if scalar(@{$self->{-low_prio_q}}); + my $http = $gzf->{env}->{'psgix.io'}; # PublicInbox::HTTP + $http->next_step($gzf->can('async_next')); +} + 1; |