jberger / Mojo-IOLoop-ForkCall

Deprecated! Use Mojo::IOLoop::Subprocess instead
https://mojolicious.org/perldoc/Mojo/IOLoop/Subprocess
5 stars 2 forks source link

Stream in parent will timeout after default 15 second delay #4

Closed lsuchocki closed 10 years ago

lsuchocki commented 10 years ago

Patch adds timeout parameter to run() which is passed onto Mojo::IOLoop::Stream object.

diff -r a/lib/Mojo/IOLoop/ForkCall.pm b/lib/Mojo/IOLoop/ForkCall.pm
25c25
<   my ($args, $cb);

---
>   my ($args, $cb, $timeout);
27a28
>   $timeout = shift if @_;
57a59,60
>     $stream->timeout($timeout) if defined $timeout;
>     
113c116,117
<    sub { my ($fc, $err, @return) = @_; ... }

---
>    sub { my ($fc, $err, @return) = @_; ... },
>    $timeout
214c218
<  $fc->run( sub { my @args = @_; child code; return @res }, \@args, $cb );

---
>  $fc->run( sub { my @args = @_; child code; return @res }, \@args, $cb, $timeout );
218a223
> If job does not return within specified timeout in seconds (default that of Mojo::IOLoop::Stream, 15 seconds), the job will be aborted. Use 0 for no timeout.