Lets say, I have an observable A that emits every second. I have an observer B whose OnNext method takes 5 to 10 seconds or sometimes more or less. I want to throttle A such that B is executed as often as possible (but synchronous, no multitreading) and always with the latest emission that arrived during execution of B.
Maybe like this:
A -----1--2--3--4--5--6--7--8--
B |1-----|3-------|6--|7--
A emits 1. B starts executing on 1 and takes some time. The 2 is discarded. When B is done executing on 1 the latest emission on A is 3. B starts execting immediatly on 3. And so on.
I know there is the operator throttle (or debounce) but it takes a time span and as stated above I don't know the exact execution time.
Is there a combination of operators I can use for this?