Skip to content

Commit

Permalink
added transaction example for non-blocking operations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 10, 2013
1 parent f61a6e3 commit 8536012
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -527,6 +527,12 @@ underlying connection might get closed early.
my $address = $c->tx->remote_address;
my $port = $c->tx->remote_port;
# Perform non-blocking operation without knowing the connection status
my $tx = $c->tx;
Mojo::IOLoop->timer(2 => sub {
$c->app->log->debug($tx->is_finished ? 'Finished.' : 'In progress.');
});
=head1 METHODS
L<Mojolicious::Controller> inherits all methods from L<Mojo::Base> and
Expand Down

0 comments on commit 8536012

Please sign in to comment.