-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interval emits events at once on second subscription #413
Comments
hi Thanks for the report !this is by design, but unintended.. I need to think about this a bit.. |
Similarly, the code below prints the numbers 1 through 4 with 1 second in between, then immediately prints 1 through 7 before continuing to print another number every 500ms. This surprised me since the documentation for concat states that subsequent observables won't be subscribed to until the preceding ones complete.
This is actually quite frustrating. I'm finding it impossible to create a stream that produces values at one interval and then produces values at a different interval once the first completes. Even the following code behaves the same as the above which makes no sense to me since the second interval stream isn't even connected until the first completes.
|
To see rx-interval.hpp, initial.initial (the starting time point) is initialized by now() on the constructor, and that causes the problem.
The workaround "wrapping the interval in defer" also worked.
|
I am not sure if it is an intended behavior or not.
The following code
outputs the followings:
The first subscription (A) has the events emitted with 1 second interval as expected. However, the second subscription (B) has the events emitted with just several milisecs in between.
Just for completion, the 'time_point_to_string' function is as follows:
The text was updated successfully, but these errors were encountered: