From bb5283684d1dcfce9ed0644bde50e5bedacb08b4 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Mon, 7 Jun 2021 18:04:20 +0600 Subject: [PATCH] Fix #2559: maxTotalRetriesDuration = soTimeout * maxAttempts (#2560) --- src/main/java/redis/clients/jedis/BinaryJedisCluster.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/redis/clients/jedis/BinaryJedisCluster.java b/src/main/java/redis/clients/jedis/BinaryJedisCluster.java index 821248d268..79a4d687b5 100644 --- a/src/main/java/redis/clients/jedis/BinaryJedisCluster.java +++ b/src/main/java/redis/clients/jedis/BinaryJedisCluster.java @@ -81,7 +81,7 @@ public BinaryJedisCluster(Set jedisClusterNode, int connectionTimeo this.connectionHandler = new JedisSlotBasedConnectionHandler(jedisClusterNode, poolConfig, connectionTimeout, soTimeout, user, password, clientName); this.maxAttempts = maxAttempts; - this.maxTotalRetriesDuration = Duration.ofMillis(soTimeout); + this.maxTotalRetriesDuration = Duration.ofMillis((long) soTimeout * maxAttempts); } public BinaryJedisCluster(Set jedisClusterNode, int connectionTimeout, @@ -90,7 +90,7 @@ public BinaryJedisCluster(Set jedisClusterNode, int connectionTimeo this.connectionHandler = new JedisSlotBasedConnectionHandler(jedisClusterNode, poolConfig, connectionTimeout, soTimeout, infiniteSoTimeout, user, password, clientName); this.maxAttempts = maxAttempts; - this.maxTotalRetriesDuration = Duration.ofMillis(soTimeout); + this.maxTotalRetriesDuration = Duration.ofMillis((long) soTimeout * maxAttempts); } public BinaryJedisCluster(Set jedisClusterNode, int connectionTimeout, @@ -169,7 +169,7 @@ public BinaryJedisCluster(Set jedisClusterNode, int connectionTimeo public BinaryJedisCluster(Set jedisClusterNode, JedisClientConfig clientConfig, int maxAttempts, GenericObjectPoolConfig poolConfig) { this(jedisClusterNode, clientConfig, maxAttempts, - Duration.ofMillis((long) DEFAULT_TIMEOUT * maxAttempts), poolConfig); + Duration.ofMillis((long) clientConfig.getSocketTimeoutMillis() * maxAttempts), poolConfig); } public BinaryJedisCluster(Set jedisClusterNode, JedisClientConfig clientConfig,