Skip to content

Commit

Permalink
increase graceful_timeout from 20 to 60 seconds and make the log mess…
Browse files Browse the repository at this point in the history
…age for immediate shutdown a little more threatening
  • Loading branch information
kraih committed Jul 4, 2017
1 parent 4d9b7f3 commit 93e314e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@

7.35 2017-07-04
- Removed deprecated watch attribute from Mojo::Server::Morbo.
- Increased default graceful_timeout from 20 to 60 seconds in
Mojo::Server::Prefork.

7.34 2017-07-02
- Added short attribute to Mojo::Log.
Expand Down
11 changes: 6 additions & 5 deletions lib/Mojo/Server/Prefork.pm
Expand Up @@ -8,9 +8,10 @@ use Mojo::Util 'steady_time';
use POSIX 'WNOHANG';
use Scalar::Util 'weaken';

has accepts => 10000;
has cleanup => 1;
has [qw(graceful_timeout heartbeat_timeout)] => 20;
has accepts => 10000;
has cleanup => 1;
has graceful_timeout => 60;
has heartbeat_timeout => 20;
has heartbeat_interval => 5;
has pid_file => sub { path(tmpdir, 'prefork.pid')->to_string };
has workers => 4;
Expand Down Expand Up @@ -123,7 +124,7 @@ sub _manage {
$w->{force} = 1 if $graceful && $graceful + $gt <= $time;

# Normal stop
$log->debug("Stopping worker $pid")
$log->debug("Stopping worker $pid immediately")
and (kill 'KILL', $pid or $self->_stopped($pid))
if $w->{force} || ($self->{finished} && !$graceful);
}
Expand Down Expand Up @@ -376,7 +377,7 @@ a true value.
$prefork = $prefork->graceful_timeout(15);
Maximum amount of time in seconds stopping a worker gracefully may take before
being forced, defaults to C<20>. Note that this value should usually be a little
being forced, defaults to C<60>. Note that this value should usually be a little
larger than the maximum amount of time you expect any one request to take.
=head2 heartbeat_interval
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/prefork.pm
Expand Up @@ -55,7 +55,7 @@ Mojolicious::Command::prefork - Pre-fork command
SOMAXCONN
-c, --clients <number> Maximum number of concurrent
connections, defaults to 1000
-G, --graceful-timeout <seconds> Graceful timeout, defaults to 20.
-G, --graceful-timeout <seconds> Graceful timeout, defaults to 60.
-I, --heartbeat-interval <seconds> Heartbeat interval, defaults to 5
-H, --heartbeat-timeout <seconds> Heartbeat timeout, defaults to 20
-h, --help Show this summary of available options
Expand Down

0 comments on commit 93e314e

Please sign in to comment.