-
Hello folks, I'm encountering an issue with the following scenario:
I was expecting Lettuce to automatically use server 05 and don't bother anymore with server 02. And/or at least raise errors but not "wait indefinitely". Logs in the app are like this:
In the meantime, requests are "waiting" and never sent to to the new Redis master server. What am I missing here? I'm kinda new to both Redis and Lettuce. Any help will be appreciated. For the record, following code is used: // Done once (at initialization of the app/service basically)
List<RedisURI> uris = ...
RedisClusterClient client = RedisClusterClient.create(uris);
client.getPartitions(); // Get partitions to ensure that client is ready https://github.com/lettuce-io/lettuce-core/issues/928
Future<StatefulRedisClusterConnection<String, String>> redisConnection = client.connectAsync(StringCodec.UTF8);
// Then, for each request of the app
// (we actually do this with Scala but the idea translates to the following in Java)
Future<String> futureResult = redisConnection.thenCompose(connection -> connection.async().get("...")); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Just tried adding a timeout (I though there was one by default actually) with It's better as now the requests do fail after 5s instead of waiting infinitely but still Lettuce is not connecting to the new Redis master. |
Beta Was this translation helpful? Give feedback.
-
Commands time out after 60 seconds by default. You can control the command timeout via |
Beta Was this translation helpful? Give feedback.
Adding a topology refresh seems to do the trick
ClusterTopologyRefreshOptions.builder().enableAllAdaptiveRefreshTriggers()
in addition to the timeout.