dartis icon indicating copy to clipboard operation
dartis copied to clipboard

Support timeout hanging commands

Open jonasfj opened this issue 7 years ago • 1 comments

It seems like a good idea to support timeout of commands like get and set and break the connection, if the timeout is violated..

This could be handled further down the stack, but consumers of this library. But it could also be an option passed to Client when created.

jonasfj avatar Nov 28 '18 15:11 jonasfj

We could add a "connection timeout".

static Future<Client> connect(String connectionString, {Duration connectTimeout}) async {

But I'm not sure about a "command timeout". I think that clients already can achieve the same result using Future's capabilities.

And note that when using the "fire and forget" feature the timeout should be ignored.

The main responsibility of the library must be to implement the Redis protocol. Others responsibilities should rely in other components. I really would like to work with a more generic mechanism, like the following one:

@timeout(timeLimit=100)
void process() {
  commands...
}

jcmellado avatar Dec 05 '18 09:12 jcmellado