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