flyingpig
flyingpig

Reputation: 622

Angular multiple http post requests give me error: "net::ERR_INSUFFICIENT_RESOURCES"

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.

Upvotes: 1

Views: 4716

Answers (1)

Falyoun
Falyoun

Reputation: 3976

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.

Upvotes: 2

Related Questions