Skip to content

Commit

Permalink
brought back ability to disable inactivity timeouts with test
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 22, 2011
1 parent d5e4d95 commit 9121e68
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.40 2011-12-22 00:00:00
2.40 2011-12-23 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
2 changes: 1 addition & 1 deletion t/mojo/ioloop.t
Expand Up @@ -212,7 +212,7 @@ my ($client, $server, $client_after, $server_before, $server_after) = '';
Mojo::IOLoop->server(
{port => $port} => sub {
my ($loop, $stream) = @_;
$stream->on(
$stream->timeout(0)->on(
read => sub {
my ($stream, $chunk) = @_;
Mojo::IOLoop->timer(
Expand Down

0 comments on commit 9121e68

Please sign in to comment.