-
-
Save anonymous/53a09d0023f170c1a637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.10.1; | |
use strict; | |
use warnings; | |
use Mojo::IOLoop; | |
use Mojo::Server::Daemon; | |
use Mojo::UserAgent; | |
my $daemon = Mojo::Server::Daemon->new; | |
$daemon->start; | |
for my $i (1 .. 100000) { | |
say $i; | |
my $ua = Mojo::UserAgent->new; | |
Mojo::IOLoop->delay( | |
sub { | |
my $delay = shift; | |
$ua->get('http://127.0.0.1:3000' => $delay->begin); | |
}, | |
sub { | |
my ($delay, $tx) = @_; | |
say $tx->res->code; | |
$ua->get('http://127.0.0.1:3000' => $delay->begin); | |
}, | |
sub { | |
my ($delay, $tx) = @_; | |
say $tx->res->code; | |
} | |
)->wait; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment