vertx-redis-client
vertx-redis-client copied to clipboard
Intoroduce command timeout
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.
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.