How to wait for all Observables to complete if mergeAll is set to 10?

70 Views Asked by At

I have problem with concurrent requests to an API. If too many requests are executed in one time (it can be 200+), they start to fail with an error.

There is list of students and I need to create test assignments for them, 1 student 1 API call. I used forkJoint to group observables with API calls and wait until all requests completed, after that the user gets a notification that students were assigned tests.

It's working fine, because browser limited amount of request, 10 for Chrome if I'm not mistaken. However with HTTP/2 this limit does not work, I used this example and its helped to solve problem with amount of requests, but I still have to wait before all (200+) requests completed to show notification. I don't understandt how to make it with RxJs.

1

There are 1 best solutions below

0
Vadim Khismatov On BEST ANSWER

Final solution looks like this:

from(observables)
  .pipe(mergeAll(10), toArray())
  .subscribe();