-
Notifications
You must be signed in to change notification settings - Fork 362
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
Shared observable can not be retried #202
Comments
That is interesting, and looks like a problem. I'll take a look when I get a chance if Dag doesn't beat me. |
I think the behavior is correct, since you are publishing the result of source. Thus a re-subscribe (retry) will not help since the the published subject already has error-ed. The next subscribe will just fail. If you remove |
A similar discussion dotnet/reactive#238 |
Thanks for looking into this. I think the behaviour is different in rxjs. See ReactiveX/rxjs/issues/678. Maybe there is no consensus between the various implementations? Edit: Here is an example of the expected behaviour with RxJS 5.3.4 (inspect the output in the browser console). |
I missed that error part, I agree with Dag. |
The problem is that you are trying to retry a hot observable. The question is really to what lengths we should go to make things like My initial thought would be to try and solve this scenario in a different way by using |
Something like this to keep the source cold. I btw. need to fix this so it works with generators directly so you don't have to use the #!/usr/bin/env python3.6
from rx import Observable
from rx.internal.enumerable import Enumerable
source = Observable.interval(100).take(3)
def factory():
for x in range(3):
yield source.concat(Observable.throw(Exception('BOOM'))).share()
Observable.catch_exception(Enumerable(factory())).subscribe(lambda v: print('on_next: ', v),
lambda e: print('on_error: ', e),
lambda: print('on_completed'))
input("Press enter to exit...\n") |
Thanks to both of you for taking your time to look at this issue.
That makes sense. It would be nice to have multicast special-case this scenario so that
Thanks for the code example; I'm going to use that. I tried myself to use
Yeah, that would simplify things for the user. Thanks again. |
@frederikaalund Note that I have now updated my code example to put the |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Example program:
I expect to see the following output
...
on_next: 0
on_next: 1
on_next: 2
on_next: 0
on_next: 1
on_next: 2
on_next: 0
on_next: 1
on_next: 2
on_error: BOOM
...
Instead, I get the following output
...
on_next: 0
on_next: 1
on_next: 2
on_error: BOOM
...
Python 3.6.1
RxPy: 1.5.9
The text was updated successfully, but these errors were encountered: