Closed ianburrell closed 8 years ago
I'm not sure what this patch does which the current code doesn't? Can't you just create a ProcManager object on your own with whatever configuration and set it to manager?
Problem is that the "manager" is not used in non-listen mode. The $proc_manager is only assigned and used when "listen" or $running_under_server_starter.
It would be fine if "manager" object had to be constructed externally and passed in for single-process mode.
Change would look like:
# detach *before* the ProcManager inits
$self->daemon_detach if $self->{daemonize};
-
- $proc_manager->pm_manage;
}
elsif ($self->{daemonize}) {
$self->daemon_detach;
}
+ } elsif (blessed $self->{manager}) {
+ $proc_manager = $self->{manager};
}
+ $proc_manager && $proc_manager->pm_manage;
+
while ($request->Accept >= 0) {
Yeah that sounds more like a minimal change to make things that you want possible.
I updated the pull request with a simpler version that allows passing "manager" object in the web server single-process mode. It does depend on the caller constructing the FCGI::ProcManager with n_processes => 0. It doesn't require changing the proc manager construction and defaults.
FCGI::ProcManager supports running in single-process mode when n_processes is zero. It is useful (for harakiri support) to run with proc manager in single-process mode.
This refactors _create_proc_manager method to create the manager object. It uses different default manager class and number processes between listen mode and single process mode. It keeps the old behavior for single-process mode without manager. It would be possible to create proc manager by default or always.