Quarkus Redis client timeout shorter than a second
See original GitHub issueDescribe the bug
The docs says Redis client timeout is defined as a Duration
:
https://quarkus.io/guides/redis#quarkus-redis-client_quarkus.redis.timeout
A Duration
object is later passed to an underlying implementation, as can be seen here:
https://github.com/quarkusio/quarkus/blob/6dce42371c631b3070a953dbe57cfd94f33dc5a1/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java#L1026
but, internally, only seconds precision is used: https://github.com/quarkusio/quarkus/blob/6dce42371c631b3070a953dbe57cfd94f33dc5a1/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java#L15
, with the timeout
parameter representing the seconds.
So, without fractional seconds precision, we lost the ability to have timeouts shorter than a second.
Expected behavior Instead of silently discarding fractional seconds part, which later leads to a misleading error when client is used:
java.lang.IllegalArgumentException: `duration` must be greater than zero
, it would be nice to allow timeouts shorter than a second, by storing the Duration
internally and later passing it as is to Mutiny Redis Client.
The alternative is to throw a more precise exception, saying for instance that timeouts shorter than a second, even though they’re allowed by the Duration
, are not allowed.
To Reproduce Define a timeout shorter than a second and try using a RedisClient. E.g.:
quarkus.redis.timeout=PT0.1S
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
@abutic I’ll close it.
Just as an FYI for next time, if you add
Fixes: #NNNNN
like I have done in the description of your PR, GH will automatically link the PR to the issue 😃@gsmet and @machi1990, should I close this issue, now that it’s fixed by #15211? Also, should the PR be linked to this issue (I don’t seem to have the permission to link them)?