Comments (3)
No - it should not. If the connection is broken, an error occurs writing/reading to/from the connection this future will be resolved with an error. You need to use catchError
connection.done.catchError((_) {
print('Redis disconnected.');
_client = null;
});
from dartis.
Take a look to the Connection
class:
https://github.com/jcmellado/dartis/blob/master/lib/src/client/connection.dart
Extract:
/// Future that is resolved when the connection is closed.
///
/// If the connection closes gracefully this future will be completed and
/// future attempts to use the connection will throw a
/// [RedisConnectionClosedException].
///
/// If the connection is broken, an error occurs writing/reading to/from the
/// connection this future will be resolved with error. If unhandled this
/// will propagate to the encapsulating [Zone] where it may be handled.
/// If using the default root [Zone] this will cause the isolate to crash.
///
/// If not implementing custom reconnection logic it might be desirable to
/// simply restart the process when it crashes.
///
/// If implementing custom reconnection logic, consumers should stop using a
/// connection once [done] have been resolved, as all future commands will
/// will throw an error. If an error occurs reading or writing all outstanding
/// commands will be resolved with an exception.
Future<void> get done => _done.future;
There some tests about that too:
https://github.com/jcmellado/dartis/blob/master/test/client/connection_test.dart
from dartis.
final connection = await dartis.Connection.connect(
'redis://${host ?? 'localhost'}:${port}');
unawaited(connection.done.then((err) {
print('Redis disconnected.');
_client = null;
}));
_client = await dartis.Client(connection);
The above snippet is not printing the message when I start the app and after stop the local redis service to break the connection.
It shoud, right?
from dartis.
Related Issues (20)
- Full support for PubSub HOT 2
- Adding a custom exception for watch
- "pubsub.stream.listen(print, onDone: (){print('done')}). " the "onDone:" never work. HOT 1
- hgetall broken? HOT 3
- Connection with password HOT 2
- Supply password with PubSub HOT 6
- Add support for Redis streams HOT 1
- Add support for ACL commands - Redis 6 HOT 3
- publish problem HOT 2
- Should support connectionString containing password HOT 3
- How do we connect to an SSL port?
- Add support for Web HOT 1
- Migrate to null safety HOT 2
- Is there a plan to migrate to dart null safety? HOT 18
- Can pipeline have unwanted results? HOT 2
- Can I use RedisSearch? HOT 2
- tls and rediss:// suppot?
- How to reconnect when connection is stale? HOT 3
- Socket flush?
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 dartis.