Angular multiple http post requests give me error: “net::ERR_INSUFFICIENT_RESOURCES”

最后都变了- 提交于 2021-01-01 06:59:04

问题


I am importing an .xlsx file, which has 6000 customers inside and I am trying to loop throught customers and make an http post request foreach customer, but I get this error:

net::ERR_INSUFFICIENT_RESOURCES.

How can I insert these customers? They need to be passed throught my backend in order to get encrypted.

this.customers.forEach(customer => {
   this.customerService
     .createCustomer(customer)
     .pipe(take(1))
     .subscribe(() => {});
});

Only 2000 customers are imported. Any way to fix it?

Thanks.


回答1:


As i know by the way i am not 100% sure but the browser especially Chrome can't handle a very large number of requests in a short period of time,

And to solve this just try to make a bit delay after 2000 request as you mentioned that this number could be handled.



来源:https://stackoverflow.com/questions/56892378/angular-multiple-http-post-requests-give-me-error-neterr-insufficient-resour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!