plack / Plack

PSGI toolkit and server adapters
http://plackperl.org/
Other
486 stars 214 forks source link

How to pass max_requests option value to FCGI::ProcManager::Constrained when using plackup? #686

Closed XSven closed 1 year ago

XSven commented 1 year ago

I do not know how to pass the max_requests option value to the constructor of the FCGI::ProcManager::Constrained manager when calling

plackup ... --server FCGI --manager FCGI::ProcManager::Constrained --max_requests 10 ...

I have read this but I do not know how to use it because the creation of the Plack::Handler::FCGI server is not configurable if plackup is called.

miyagawa commented 1 year ago

You can't.

Instead, you can script it with Plack::Handler::FCGI directly and pass a custom manager object.

use Plack::Util;

my $app = load_psgi("app.psgi");

my $manager = FCGI::ProcManager::Constrained->new(
  max_requests => 10,
  ...
);

my $handler = Plack::Handler::FCGI->new(
  manager => $manager, 
  ...
);
$handler->run$($app);