I have this parallel request mechanism in a ReactJS project. I followed the online sources while implementing this. I gather the promises in an array than feed it to allSettled then collect the result.
let promises = [];
for (const [_, url] of urls) {
promises.push(axios.get(`https://url`, {
timeout: 5000,
signal: AbortSignal.timeout(5000), //Aborts request after 5 seconds
}));
}
const result = await Promise.allSettled(promises)
My problem is that, in firefox this executes perfectly. However in Chrome, all the requests happen one by one(not parallel), so it is very slow and eventually timeout because of the 5 second limit I’ve put in.
Another interesting this is, if I open network tab and select “disable cache”, in Chrome, there requests happen in parallel and work the way they are supposed to.
What could be the reason for this?
axios version: 1.4.0
Node version: 18.2