Enable command retries for RedisClient and RedisSentinelClient by default - #4490
Enable command retries for RedisClient and RedisSentinelClient by default#4490uglide wants to merge 9 commits into
Conversation
077aa3c to
a38f383
Compare
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
a38f383 to
a149603
Compare
40348e3 to
2648aad
Compare
c460594 to
76ac06c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b4bab31. Configure here.
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new JedisException(e); | ||
| } |
There was a problem hiding this comment.
Cluster sleep interrupt now throws wrong exception type
Medium Severity
The sleep method in ResilientCommandExecutor throws JedisException on interrupt, but the old ClusterCommandExecutor.sleep threw JedisClusterOperationException. Since ClusterCommandExecutor now inherits this sleep, any code catching JedisClusterOperationException specifically (including internal retry logic or user code) will miss the interrupt-triggered exception. This is a behavioral regression for cluster clients experiencing thread interruption during backoff.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b4bab31. Configure here.


Add retries to DefaultCommandExecutor and consolidate all client classes to support command retries by default.
Note
High Risk
Default retry behavior and exception types change for all standalone/sentinel clients; UnifiedJedis is no longer directly instantiable, which is a breaking migration for custom construction paths.
Overview
Standalone and sentinel clients now retry transient connection failures by default (5 attempts, time budget
socketTimeout × maxAttempts), matching cluster behavior.DefaultCommandExecutorimplements the retry loop; sharedResilientCommandExecutorcentralizes backoff withClusterCommandExecutor.maxAttempts/maxTotalRetriesDurationmove toAbstractClientBuilderfor allRedisClient*builders; exhausted retries throwJedisException(with suppressedJedisConnectionException) instead of failing fast on the first blip.API tightening:
UnifiedJedisisabstract;DEFAULT_TIMEOUTandDEFAULT_MAX_ATTEMPTSlive onUnifiedJedis(removed fromRedisClusterClient). TheUnifiedJedis(provider, maxAttempts, duration)constructor is removed; use builders orDefaultCommandExecutor.RetryableCommandExecutoris deprecated in favor ofDefaultCommandExecutor.The v7→v8 migration guide documents opt-out via
maxAttempts(1)and exception-handling updates. Tests and examples were updated accordingly.Reviewed by Cursor Bugbot for commit b4bab31. Bugbot is set up for automated code reviews on this repo. Configure here.