Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed automatic restarting of worker processes
  • Loading branch information
kraih committed Jan 16, 2013
1 parent b694b2b commit a85f2bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/Mojo/Server/Prefork.pm
Expand Up @@ -49,12 +49,14 @@ sub run {
# No Windows support
say 'Preforking not available for Windows.' and exit 0 if $^O eq 'MSWin32';

# Preload application and start accepting connections
# Prepare lock file and event loop
$self->{lock_file} = $self->lock_file . ".$$";
$self->start->app;
my $loop = $self->ioloop->max_accepts($self->accepts);
$loop->$_($self->$_) for qw(accept_interval multi_accept);

# Preload application and start accepting connections
$self->start->app;

# Pipe for worker communication
pipe($self->{reader}, $self->{writer}) or die "Can't create pipe: $!";
$self->{poll} = IO::Poll->new;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Command/prefork.pm
Expand Up @@ -58,11 +58,11 @@ sub run {
'heartbeat-interval=i' => sub { $prefork->heartbeat_interval($_[1]) },
'H|heartbeat-timeout=i' => sub { $prefork->heartbeat_timeout($_[1]) },
'i|inactivity=i' => sub { $prefork->inactivity_timeout($_[1]) },
'lock-file=i' => sub { $prefork->lock_file($_[1]) },
'lock-file=s' => sub { $prefork->lock_file($_[1]) },
'L|lock-timeout=i' => sub { $prefork->lock_timeout($_[1]) },
'l|listen=s' => \my @listen,
'multi-accept=i' => sub { $prefork->multi_accept($_[1]) },
'P|pid-file=i' => sub { $prefork->pid_file($_[1]) },
'P|pid-file=s' => sub { $prefork->pid_file($_[1]) },
'p|proxy' => sub { $ENV{MOJO_REVERSE_PROXY} = 1 },
'r|requests=i' => sub { $prefork->max_requests($_[1]) },
'u|user=s' => sub { $prefork->user($_[1]) },
Expand Down

0 comments on commit a85f2bf

Please sign in to comment.