Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explicitly call to_app in psgi for performance

as recommened in Plack 1.0018
  • Loading branch information...
commit eada17e38292dce6378fc6adcd84d3102b7581e2 1 parent 53cf046
@rwstauner rwstauner authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 app.psgi
View
7 app.psgi
@@ -24,15 +24,18 @@ use Plack::Middleware::ReverseProxy;
use Plack::Middleware::Session::Cookie;
use Plack::Middleware::ServerStatus::Lite;
+# explicitly call ->to_app on every Plack::App::* for performance
my $app = Plack::App::URLMap->new;
-$app->map( '/static/' => Plack::App::File->new( root => 'root/static' ) );
+$app->map( '/static/' => Plack::App::File->new( root => 'root/static' )->to_app );
$app->map( '/favicon.ico' =>
- Plack::App::File->new( file => 'root/static/icons/favicon.ico' ) );
+ Plack::App::File->new( file => 'root/static/icons/favicon.ico' )->to_app );
$app->map( '/' => MetaCPAN::Web->psgi_app );
my $scoreboard = "$FindBin::RealBin/var/tmp/scoreboard";
unless (-d $scoreboard) {
File::Path::make_path($scoreboard) or die "Can't make_path $scoreboard: $!";
}
+
+$app = $app->to_app;
$app = Plack::Middleware::ServerStatus::Lite->wrap(
$app,
path => '/server-status',
Please sign in to comment.
Something went wrong with that request. Please try again.