0

class RedisCluster(Redis):
"""
If a command is implemented over the one in Redis then it requires some changes compared to
the regular implementation of the method.
"""
RedisClusterRequestTTL = 16

RedisClusterRequestTTL is a constant which control the num of retry time.


ttl = int(self.RedisClusterRequestTTL)
connection_error_retry_counter = 0
while ttl > 0:
    ttl -= 1
    connection = None
    try:
        if asking:
            node = self.connection_pool.nodes.nodes[redirect_addr]
            connection = self.connection_pool.get_connection_by_node(node)
        elif try_random_node:
            connection = self.connection_pool.get_random_connection()
            try_random_node = False

I'd like to know that if there was a possible way that we can modify this to reducing the retry time to avoid too-much-retry on race-condition?

redis-py-cluster==2.1.0

i noticed that cluster_down_retry_attempts is a possible way which outside the while loop which could control retry times. Im look forward to change RedisClusterRequestTTL in someway (16 is too much)

0 Answers0