Skip to content
Advertisement

Flux – parallel flatMap with webclient – limit to fixed batched rate

The code I have is this:

JavaScript

It just requests HEAD, until first 6 requests are successful.

Parallelization works here, but the problem is that after 1 of the requests is complete, it immediatley triggers next request (to maintain parallelization level of 6). What I need here is to have parallelization level of 6, but in batches. So – trigger 6 requests, wait until all complete, trigger again 6 requests …

This is the output of the log() above:

JavaScript

UPDATE

this is what I tried with the buffer:

JavaScript

Advertisement

Answer

OK, It seems I have the code that works. Here I use window:

JavaScript
Advertisement