Closed SS-TruMinds closed 2 years ago
Setting the option redisClusterSetOptionConnectTimeout()
should work for connection timeouts.
There is a testcase which uses an alternative connect API, but should work in a similar fashion.
https://github.com/Nordix/hiredis-cluster/blob/6c0aecfcf1df378494e81fa69f2645eb4c5e6de1/tests/ct_connection.c#L498-L521
Great, we will try this out. Thank you for the support.
We have tried as in the example you mentioned & async connection timeout works with redisClusterConnect2(). But doesn't work with redisClusterAsyncConnect(). Could you please let us know if that is expected? Thank you.
Since redisClusterAsyncConnect()
both creates the context and perform a connection attempt you will not be able to configure the timeout for this attempt. So this is currently expected and the above example is your way forward I believe.
Ok, the example works for us. Thank you.
We have noticed that redisClusterAsyncConnect() blocks if the server is unavailable/unreachable. We understand that the timeout option is available for commands only after context creation, but is there a way to make redisClusterAsyncConnect() return error if the connection creation has not succeeded after a certain amount of time?
Thank you.