Created
September 8, 2018 10:03
-
-
Save wilk/846236aaa477e1c7364e5810885707e4 to your computer and use it in GitHub Desktop.
microjob async example
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
const res = await job(async () => { | |
let i = 0 | |
for (i = 0; i < 1000000; i++) { | |
for (let j = 0; j < 1000000; j++) { | |
for (let k = 0; k < 1000000; k++) { | |
await http.get('www.google.it') | |
} | |
} | |
} | |
return i | |
}) | |
console.log(res) // 1000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment