Hi
I am trying to make concurrent requests like this:
use 5.016;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
say "starting " . scalar localtime();
my $tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('http://www.google.com/');
$ua->start($tx => \&mojo_callback);
$tx = Mojo::Transaction::HTTP->new;
$tx->req->method('GET');
$tx->req->url->parse('http://www.google.com/');
$ua->start($tx => \&mojo_callback);
sub mojo_callback{
my ($ua, $tx) = @_;
say $tx->res->code . " " . scalar localtime() ;
}
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
say "after is_running " . scalar localtime();
But is_running is taking up to 20 seconds until finish.
How can I enqueue 2 concurrent requests and after both ended immediatly
continue?
cheers
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.