I'm sending around 0 - 10 000 fetch requests with JavaScript.
Currently I'm returning a promise that contains a for loop that loops through the fetch requests. This is extremely slow however.
await new Promise((resolve, reject) => {
for (let i = 0; i < 10 000; i++) {
let promise = fetch(`website.com/page={i}`)
.then() // process data
promise_array.push(prom);
Promise.allSettled(promise_array).then(() => {
resolve();
})
}
What is a more efficient way to do this?