I am using axios.all to hit all my post calls at a time. Here is my code
let postUrls = [];
data.forEach(inventory => {
const userData = {
stream: stream_name,
key: inventory.serialNumber,
address: address,
data: inventory,
};
const postRequest = axios.post(`${serviceURL}/publishExcelData`,
userData,);
postUrls.push(postRequest)
});
axios.all(postUrls)
.then(
axios.spread((...responses) => {
const inventoryData = responses.map(response => response.data);
// use/access the results
console.log(inventoryData.length);
})
)
.catch(errors => {
// react on errors.
console.error(errors);
});*/
This works fine with data size of 1000. But when the data size is 1000 then i am getting etimedout error. Any solution for this please. I have tried setting http agentalive true but no use.
I resolved it by making 50 requests at a time till the total count(50k). If any one is facing issue using axios.all here is my code.