Skip to content

Support setting "manager" for Plack::Handler::FCGI in single-process mode#535

Merged
miyagawa merged 1 commit intoplack:masterfrom
rentrak:fcgi-manager
Nov 19, 2015
Merged

Support setting "manager" for Plack::Handler::FCGI in single-process mode#535
miyagawa merged 1 commit intoplack:masterfrom
rentrak:fcgi-manager

Conversation

@ianburrell
Copy link
Copy Markdown

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.

@miyagawa
Copy link
Copy Markdown
Member

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?

@ianburrell
Copy link
Copy Markdown
Author

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.

@ianburrell
Copy link
Copy Markdown
Author

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) {

@miyagawa
Copy link
Copy Markdown
Member

Yeah that sounds more like a minimal change to make things that you want possible.

@ianburrell
Copy link
Copy Markdown
Author

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.

miyagawa added a commit that referenced this pull request Nov 19, 2015
Support setting "manager" for Plack::Handler::FCGI in single-process mode
@miyagawa miyagawa merged commit 0a8eea4 into plack:master Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants