@@ -1561,25 +1561,25 @@ def initialize(self):
1561
1561
# add this node to the nodes cache
1562
1562
tmp_nodes_cache [target_node .name ] = target_node
1563
1563
1564
+ target_replica_nodes = []
1565
+ for replica_node in slot [3 :]:
1566
+ host = str_if_bytes (replica_node [0 ])
1567
+ port = int (replica_node [1 ])
1568
+ host , port = self .remap_host_port (host , port )
1569
+
1570
+ target_replica_node = self ._get_or_create_cluster_node (
1571
+ host , port , REPLICA , tmp_nodes_cache
1572
+ )
1573
+ target_replica_nodes .append (target_replica_node )
1574
+ # add this node to the nodes cache
1575
+ tmp_nodes_cache [target_replica_node .name ] = target_replica_node
1576
+
1564
1577
for i in range (int (slot [0 ]), int (slot [1 ]) + 1 ):
1565
1578
if i not in tmp_slots :
1566
1579
tmp_slots [i ] = []
1567
1580
tmp_slots [i ].append (target_node )
1568
- replica_nodes = [slot [j ] for j in range (3 , len (slot ))]
1569
-
1570
- for replica_node in replica_nodes :
1571
- host = str_if_bytes (replica_node [0 ])
1572
- port = replica_node [1 ]
1573
- host , port = self .remap_host_port (host , port )
1574
-
1575
- target_replica_node = self ._get_or_create_cluster_node (
1576
- host , port , REPLICA , tmp_nodes_cache
1577
- )
1581
+ for target_replica_node in target_replica_nodes :
1578
1582
tmp_slots [i ].append (target_replica_node )
1579
- # add this node to the nodes cache
1580
- tmp_nodes_cache [
1581
- target_replica_node .name
1582
- ] = target_replica_node
1583
1583
else :
1584
1584
# Validate that 2 nodes want to use the same slot cache
1585
1585
# setup
0 commit comments