Comments (4)
There's an important gotcha to consider here,
In Dart we have 2 Stream types, single-subscription and multi-subscription.
For multi-subscription, there is no issue, we simply resubscribe when onError triggers,
on the other hand single-subscriptions cannot be resubscribed to (it would throw).
For the latter, either we simply swallow the Error, pretty much the current retry implementation, or we let retry throw right away, with a proper message saying resubscription is impossible here
thoughts?
from rxdart.
or we let retry throw right away, with a proper message saying resubscription is impossible here
Here I mean, we throw even if no onError occurs, the retry operator simply should not be allowed on a single-subscription Observable
from rxdart.
Yeah, another tricky difference between the two implementations!
That's an interesting idea -- perhaps the best way would be to add an assert clause at the earliest possible point that would inform the developer that retry only works with multi-subscription streams.
That way we can "fail fast" and inform the developer of the mistake, rather than swallowing the developer error.
from rxdart.
Hi, @frankpepermans
For multi-subscription stream, the onListen side effect will only be trigged at the first time it is listened.
See: https://dartpad.dartlang.org/b25b41c71f035fd61cb16b4a9a6e3fab
So, I think either document that the retry
won't trigger the onListen
side effect, or change the api to something like:
retry(Stream streamCreator()) {
...
onError: (_) {
streamCreator().listen(streamController.add, ...)
}
}
Then streamCreator
will be used to restart side effect (like sending http request).
How do you think?
from rxdart.
Related Issues (20)
- BehaviorSubject doesn't provide value via 'first' in test environment HOT 1
- Addition of Copyright Notice HOT 3
- StackOverflowError forwarding_stream.dart in _MultiControllerSink.add HOT 3
- StreamSubscription pause()/resume() with PublishSubject.stream.listen not working HOT 2
- throttled stream ignores the close command
- BehaviorSubject() doesn't provide value with defaultIfEmpty(...) HOT 1
- When will the version bump to 1.y.z HOT 1
- BUG: non-broadcast Stream cannot be listened more than once when asyncMap is used HOT 5
- .shareValue() does not provide up-to-date .value HOT 2
- Use records in combine latest etc.
- rx.zip and rx.combineLast are not work anymore
- Nested asynchronous loops don't work with groupBy HOT 1
- How can we combine multiple streams if they depends on each other? HOT 6
- ValueStream.map should return ValueStream (?)
- Combining 2 stream with ZipStream.zip2 doesn't update streambuilder UI HOT 2
- Rx.using: clean up order
- LICENSE is not detected by pub.dev HOT 1
- `PublishSubject` doesn't work with `concatWith` operator HOT 2
- Fix `Rx.using` docs
- Use record in pairwise() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxdart.