vertx-redis-client icon indicating copy to clipboard operation
vertx-redis-client copied to clipboard

Intoroduce command timeout

Open pendula95 opened this issue 4 years ago • 1 comments

Describe the feature

While using the redis client there might be cases where sent Commands will hang because of the network issue or load issue on Redis server. In this cases sent commands will be left hanging without any response. Example is failover when redis cluster nodes will stop responding as no exception will be thrown. For this cases it would be good to introduce option to set command timeout directly via API.

I have been able to achieve this by using javarx timeout but without javarx I am not sure how I would do this with futures and promises. There does not seem to be an option. eclipse-vertx/vert.x#3307

Also I am not sure what happens to sent commands that get timedout by javarx, are they canceled on the context and are there any hidden implications?

Use cases

Better failover/reconnect handling. Better control over request/response time.

Contribution

The feature does not seem to complicated to implement. With some discussion and plan I think I would to submit PR.

pendula95 avatar May 26 '21 22:05 pendula95

One way to address this is to use:

CONFIG SET timeout 30

Add idle connections will close after 30s of idling. This is what other libraries like jedis do when you configure the timeout in the client.

The thing is that this config is per server, not connection so it needs to be used carefully.

pmlopes avatar Jul 27 '21 13:07 pmlopes