Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2016 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4396dc96647322f106ed26a92d9f928c to your computer and use it in GitHub Desktop.
Save anonymous/4396dc96647322f106ed26a92d9f928c to your computer and use it in GitHub Desktop.
use HTTP::UserAgent;
my @promises;
my @urls = <duckduckgo.com perl6.org perl6advent.wordpress.com>;
for @urls -> $url {
@promises.push: start {
my $ua = HTTP::UserAgent.new;
my $t1 = now;
say "Fetching $url";
$ua.get($url);
say "$url fetched in {now - $t1}";
}
}
await Promise.allof(@promises);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment