Right now I have the following code:
import axios from 'axios'
const urls = ['https://google.com', 'https://yahoo.com']
async function* requests() {
for (const url of urls) {
yield axios.get(url)
}
}
;(async () => {
for await (const n of requests()) {
console.log(n.config.url) // prints https://google.com and then https://yahoo.com
}
})()
As is, the requests won't block the single thread of node, but they will happen in sequence. I'm wondering if it would be possible to change the code to force parallelism.