]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www: speed up global manifest.js.gz w/ "all" extindex
authorEric Wong <e@80x24.org>
Mon, 8 Apr 2024 09:49:21 +0000 (09:49 +0000)
committerEric Wong <e@80x24.org>
Thu, 11 Apr 2024 18:17:25 +0000 (18:17 +0000)
By reducing internal event loop iterations, this brings 300+
inboxes down ~32ms to ~27ms.  It should also be more consistent
on servers with busy event loops since all the Xapian DB traffic
happens at once, theoretically mproving cache utilization.

lib/PublicInbox/ConfigIter.pm
lib/PublicInbox/ManifestJsGz.pm

index 14fcef83f2293d85e3798bc47e43736052823209..f9e3451ae97b4f25ba4bceffd0ad1a92179187fc 100644 (file)
@@ -1,12 +1,11 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Intended for PublicInbox::DS::event_loop in read-only daemons
 # to avoid each_inbox() monopolizing the event loop when hundreds/thousands
 # of inboxes are in play.
 package PublicInbox::ConfigIter;
-use strict;
-use v5.10.1;
+use v5.12;
 
 sub new {
        my ($class, $pi_cfg, $cb, @args) = @_;
@@ -25,7 +24,7 @@ sub event_step {
        PublicInbox::DS::requeue($self) if defined($section);
 }
 
-# for generic PSGI servers
+# for generic PSGI servers, but also ManifestJsGz w/ ALL extindex
 sub each_section {
        my $self = shift;
        my ($pi_cfg, $i, $cb, @arg) = @$self;
index 1f739baaa3817dbe73c9f81d829765318e2de407..be5d5f2af42fa53401c36aff64d15e7bd95ff543 100644 (file)
@@ -82,8 +82,9 @@ sub response {
                                        $ctx->can('list_match_i'), $re, $ctx);
        sub {
                $ctx->{-wcb} = $_[0]; # HTTP server callback
-               $ctx->{env}->{'pi-httpd.async'} ?
-                               $iter->event_step : $iter->each_section;
+               ($ctx->{www}->{pi_cfg}->ALL ||
+                                       !$ctx->{env}->{'pi-httpd.async'}) ?
+                               $iter->each_section : $iter->event_step;
        }
 }