Skip to content

Commit 573b72e

Browse files
committed
feat(cluster_scripts): dynamic port allocation per pool count
Updated the port allocation logic to dynamically allocate 100 ports for every 15 pools. This ensures better scalability and avoids port conflicts when the number of pools increases. - Modified `get_instance_ports` method in `cluster_scripts.py`
1 parent 9e4a14b commit 573b72e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cardano_node_tests/utils/cluster_scripts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,12 @@ def _preselect_addr(self, instance_num: int) -> str:
166166

167167
def get_instance_ports(self, instance_num: int) -> InstancePorts:
168168
"""Return ports mapping for given cluster instance."""
169-
ports_per_instance = 100
170-
ports_per_node = 5
169+
# Allocate 100 ports per each 15 pools
170+
ports_per_instance = ((self.num_pools - 1) // 15 + 1) * 100
171171
offset = instance_num * ports_per_instance
172172
base = 32000 + offset
173173
last_port = base + ports_per_instance - 1
174+
ports_per_node = 5
174175

175176
def _get_node_ports(num: int) -> NodePorts:
176177
rec_base = base + (num * ports_per_node)

0 commit comments

Comments
 (0)