Replies: 2 comments 5 replies
-
The RedisURI has precedence over the default timeout. I'm not sure how to think about it since RedisURI.timeout and the default timeout on the client create ambiguity over what shall happen. That method comes from a time where The only place that makes actually sense from the default timeout is the cluster client as Redis Cluster can be configured from multiple URI's and we need a single timeout. I think it makes sense to deprecate the timeout methods and fall back to the URI timeout. |
Beta Was this translation helpful? Give feedback.
-
@mp911de Even after setting timeouts on both RedisURI and TimeoutOptions, I've noticed that actual command execution times can exceed these values. Why might this be happening? |
Beta Was this translation helpful? Give feedback.
-
Hi,
We discovered a bug in our code related to connection timeouts. We intended to use them but apparently have failed to do so; we only set the command timeout using an approach like this:
While fixing this, I attempted to set the default timeout for the
RedisClient
(to override the connection timeout) in this way:But, interestingly enough, a default timeout of 60 seconds is still being used in this case. 😲 This can be seen by the exception details:
I looked briefly at the Lettuce code and the
RedisHandshakeHandler
timeout gets initialized like this:https://github.com/lettuce-io/lettuce-core/blob/43843bf4bdfb09c492efbcf14667da4293452479/src/main/java/io/lettuce/core/protocol/RedisHandshakeHandler.java#L46-L50
The
RedisHandshakeHandler
is initialized here:https://github.com/lettuce-io/lettuce-core/blob/43843bf4bdfb09c492efbcf14667da4293452479/src/main/java/io/lettuce/core/ConnectionBuilder.java#L135-L137
The
timeout
gets set here:https://github.com/lettuce-io/lettuce-core/blob/43843bf4bdfb09c492efbcf14667da4293452479/src/main/java/io/lettuce/core/ConnectionBuilder.java#L96-L106
TL;DR: The
RedisHandshakeHandler
ignores the timeout defined on theRedisClient
completely, but overriding it via theRedisURI
works fine (tested locally).Is this by design or should this be considered a bug? What wouuld be the correct semantics here? 🤔 The current behavior feels a bit unexpected, at least to me.
Beta Was this translation helpful? Give feedback.
All reactions