I want to iterate over an array of values and propagate each value at specific intervals until a condition is met (using take_until). The examples below just repeat 3 times for testing. I had hoped I could do something described in the third answer to that question but the results are not what I expected.
This code:
auto interval = Rx::observable<>::interval(100ms);
auto data = Rx::observable<>::from(10, 20);
interval
| Rx::zip([](auto&& interval, auto&& data)
{
logger->info("Interval: {}, Data: {}", interval, data);
return data;
}, data)
| Rx::repeat(3)
| Rx::subscribe<int>([](auto&&){});
Neither of these does what I expect with regard to timing. I had expected each of those values to be emitted 100ms apart but that is not the case. How can I best achieve what I'm trying to do? And is there documentation somewhere for interval that would explain this behavior? This seems to be related to another issue.
I'm trying to solve a problem similar to the one described here: https://stackoverflow.com/questions/41225446/rxjs5-emit-array-items-over-time-and-repeat-forever
I want to iterate over an array of values and propagate each value at specific intervals until a condition is met (using
take_until
). The examples below just repeat 3 times for testing. I had hoped I could do something described in the third answer to that question but the results are not what I expected.This code:
Produces this output:
And replacing
from
withiterate
and an array produces this output, which is even weirder:Neither of these does what I expect with regard to timing. I had expected each of those values to be emitted 100ms apart but that is not the case. How can I best achieve what I'm trying to do? And is there documentation somewhere for
interval
that would explain this behavior? This seems to be related to another issue.