about summary refs log tree commit homepage
path: root/lib/PublicInbox/WWW.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r--lib/PublicInbox/WWW.pm21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 534ee028..2434f2f5 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -132,7 +132,9 @@ sub call {
         }
 }
 
-# for CoW-friendliness, MOOOOO!
+# for CoW-friendliness, MOOOOO!  Even for single-process setups,
+# we want to get all immortal allocations done early to avoid heap
+# fragmentation since common allocators favor a large contiguous heap.
 sub preload {
         my ($self) = @_;
         require PublicInbox::ExtMsg;
@@ -148,18 +150,29 @@ sub preload {
                 require PublicInbox::Search;
                 PublicInbox::Search::load_xapian();
         };
-        foreach (qw(PublicInbox::SearchView
-                        PublicInbox::MboxGz
-                        PublicInbox::NewsWWW)) {
+        foreach (qw(PublicInbox::SearchView PublicInbox::MboxGz)) {
                 eval "require $_;";
         }
         if (ref($self)) {
+                my $pi_config = $self->{pi_config};
+                if (defined($pi_config->{'publicinbox.cgitrc'})) {
+                        $pi_config->limiter('-cgit');
+                }
                 $self->cgit;
                 $self->stylesheets_prepare($_) for ('', '../', '../../');
                 $self->www_listing;
+                $self->news_www;
+                $pi_config->each_inbox(\&preload_inbox);
         }
 }
 
+sub preload_inbox {
+        my $ibx = shift;
+        $ibx->cloneurl;
+        $ibx->description;
+        $ibx->base_url;
+}
+
 # private functions below
 
 sub r404 {