Created
December 19, 2016 14:09
Star
You must be signed in to star a gist
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 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