I'd like to fire and forget a process, but put a timeout on how long that process can run. It's easy enough to kick off a process with Mojo::IOLoop::ForkCall (deprecated) or Mojo::IOLoop::Subprocess, but I can't find any examples of adding a timeout.
Here's some pseudo code for what I'm looking for: get '/background' => sub { my $c = shift; my $subprocess = Mojo::IOLoop::Subprocess->new; $subprocess->run( sub { # limit how long the following sub should run doSlowWork(); return 1; }, sub { # required, even if you don't use it my ($subprocess, $err, @results) = @_; } ); $subprocess->ioloop->start unless $subprocess->ioloop->is_running; $c->render( text => q|background process started|); }; doSlowWork() doesn't need to return anything (output is polled for elsewhere.) Can someone point me in the right direction? Thanks! -=>j -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.