Skip to content

Commit

Permalink
order is no longer random
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 18, 2013
1 parent 94f74da commit b457155
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -345,8 +345,8 @@ latency backend web services.
</body>
</html>

Multiple events such as parallel requests can be easily synchronized with a
L<Mojo::IOLoop> delay.
Multiple events such as parallel requests can be easily synchronized with
L<Mojo::IOLoop/"delay">.

use Mojolicious::Lite;
use Mojo::IOLoop;
Expand Down Expand Up @@ -973,9 +973,8 @@ You can take full control of the L<Mojo::IOLoop> event loop.

=head2 Parallel blocking requests

You can emulate blocking behavior by using a L<Mojo::IOLoop> delay to
synchronize multiple non-blocking requests. Just be aware that the resulting
transactions will be in random order.
You can emulate blocking behavior by using L<Mojo::IOLoop/"delay"> to
synchronize multiple non-blocking requests.

use Mojo::UserAgent;
use Mojo::IOLoop;
Expand All @@ -995,7 +994,8 @@ be able to work standalone as well as inside L<Mojolicious> applications.

# Synchronize non-blocking requests portably
my $ua = Mojo::UserAgent->new;
my $delay = Mojo::IOLoop->delay(sub {
my $delay = Mojo::IOLoop->delay;
$delay->on(finish => sub {
my ($delay, $tx, $tx2) = @_;
...
});
Expand Down

0 comments on commit b457155

Please sign in to comment.