]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: enable and expand preload from mod_perl2
authorEric Wong <e@80x24.org>
Sat, 22 Aug 2015 05:06:57 +0000 (05:06 +0000)
committerEric Wong <e@80x24.org>
Sat, 22 Aug 2015 05:09:14 +0000 (05:09 +0000)
Hopefully this saves us some memory with CoW on *nix.

lib/PublicInbox/WWW.pm
public-inbox.cgi

index 2de54719163e483ccf12c0127892270c544dc274..54f63991a85b8816e145d160ac02b5f5468de057 100644 (file)
@@ -77,10 +77,17 @@ sub preload {
        require PublicInbox::Feed;
        require PublicInbox::View;
        require PublicInbox::Thread;
+       require PublicInbox::GitCatFile;
        require Email::MIME;
        require Digest::SHA;
        require POSIX;
        require XML::Atom::SimpleFeed;
+
+       eval {
+               require PublicInbox::Search;
+               require PublicInbox::Mbox;
+               require IO::Compress::Gzip;
+       };
 }
 
 # private functions below
index 63663f32c4972cf040cbdfe890d7bf2841d4cda3..75d510c092b284a685f7158566dadf4029e354d6 100755 (executable)
@@ -4,13 +4,16 @@
 use strict;
 use warnings;
 use IO::Handle;
-require PublicInbox::WWW;
+use PublicInbox::WWW;
 use CGI qw/-nosticky/;
 our $NO_SCRIPT_NAME;
 our %HTTP_CODES;
 BEGIN {
        $NO_SCRIPT_NAME = 1 if $ENV{NO_SCRIPT_NAME};
-       CGI->compile if $ENV{MOD_PERL};
+       if ($ENV{MOD_PERL}) {
+               CGI->compile;
+               PublicInbox::WWW->preload;
+       }
 
        %HTTP_CODES = (
                200 => 'OK',