Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved inactivity timeouts by allowing them to be disabled
  • Loading branch information
kraih committed Dec 22, 2011
1 parent 6c1c5a3 commit af87961
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.40 2011-12-22 00:00:00
- Improved inactivity timeouts by allowing them to be disabled.
- Fixed repository to not favor specific editors.

2.39 2011-12-22 00:00:00
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojo/IOLoop/Stream.pm
Expand Up @@ -62,8 +62,8 @@ sub resume {
weaken $self;
$self->{timer} ||= $watcher->recurring(
'0.025' => sub {
$self->emit_safe('timeout')->close
if $self && (time - ($self->{active})) >= $self->timeout;
return unless $self && (my $t = $self->timeout);
$self->emit_safe('timeout')->close if (time - ($self->{active})) >= $t;
}
);

Expand Down Expand Up @@ -279,7 +279,8 @@ global L<Mojo::IOLoop> singleton.
$stream = $stream->timeout(45);
Maximum amount of time in seconds stream can be inactive before getting
closed automatically, defaults to C<15>. Note that this attribute is
closed automatically, defaults to C<15>. Setting the value to C<0> will allow
this stream to be inactive indefinitely. Note that this attribute is
EXPERIMENTAL and might change without warning!
=head1 METHODS
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -393,7 +393,8 @@ Group for server process.
$daemon = $daemon->inactivity_timeout(5);
Maximum amount of time in seconds a connection can be inactive before getting
dropped, defaults to C<15>.
dropped, defaults to C<15>. Setting the value to C<0> will allow connections
to be inactive indefinitely.
=head2 C<ioloop>
Expand Down Expand Up @@ -453,7 +454,8 @@ User for the server process.
$server = $server->websocket_timeout(300);
Maximum amount of time in seconds a WebSocket connection can be inactive
before getting dropped, defaults to C<300>.
before getting dropped, defaults to C<300>. Setting the value to C<0> will
allow WebSocket connections to be inactive indefinitely.
=head1 METHODS
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -564,7 +564,8 @@ to C<10>.
inactivity_timeout => 10
Maximum amount of time in seconds a connection can be inactive before being
dropped, defaults to C<15>.
dropped, defaults to C<15>. Setting the value to C<0> will allow connections
to be inactive indefinitely.
=head2 C<keep_alive_requests>
Expand Down Expand Up @@ -617,7 +618,8 @@ Username for worker processes.
websocket_timeout => 150
Maximum amount of time in seconds a WebSocket connection can be inactive
before getting dropped, defaults to C<300>.
before getting dropped, defaults to C<300>. Setting the value to C<0> will
allow WebSocket connections to be inactive indefinitely.
=head2 C<workers>
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -714,7 +714,8 @@ Proxy server to use for HTTPS and WebSocket requests.
$ua = $ua->inactivity_timeout(15);
Maximum amount of time in seconds a connection can be inactive before getting
dropped, defaults to C<20>.
dropped, defaults to C<20>. Setting the value to C<0> will allow connections
to be inactive indefinitely.
=head2 C<ioloop>
Expand Down Expand Up @@ -785,7 +786,8 @@ Note that this attribute is EXPERIMENTAL and might change without warning!
$ua = $ua->websocket_timeout(300);
Maximum amount of time in seconds a WebSocket connection can be inactive
before getting dropped, defaults to C<300>.
before getting dropped, defaults to C<300>. Setting the value to C<0> will
allow WebSocket connections to be inactive indefinitely.
=head1 METHODS
Expand Down

0 comments on commit af87961

Please sign in to comment.