mirror of https://github.com/vacp2p/wakurtosis.git
Changed batching since starlark does not support yield
This commit is contained in:
parent
2b23357f48
commit
8e7c1e1127
|
@ -8,7 +8,7 @@ WAKU_LIBP2P_PORT_ID = "libp2p"
|
|||
WAKU_LIBP2P_PORT = 60000
|
||||
WAKU_SETUP_WAIT_TIME = "5"
|
||||
|
||||
WAKU_INTERCONNECTION_BATCH = "4"
|
||||
WAKU_INTERCONNECTION_BATCH = 4
|
||||
|
||||
NODE_CONFIG_FILE_LOCATION = "github.com/logos-co/wakurtosis/config/topology_generated/"
|
||||
|
||||
|
|
|
@ -89,17 +89,13 @@ def get_waku_peers(plan, waku_service_name):
|
|||
|
||||
|
||||
def interconnect_waku_nodes(plan, topology_information, services):
|
||||
def batch(iterable, n=1):
|
||||
l = len(iterable)
|
||||
for ndx in range(0, l, n):
|
||||
yield iterable[ndx:min(ndx + n, l)]
|
||||
|
||||
# Interconnect them
|
||||
for waku_service_name in services.keys():
|
||||
peers = topology_information[waku_service_name]["static_nodes"]
|
||||
|
||||
for peer_batch in batch(peers, system_variables.WAKU_INTERCONNECTION_BATCH):
|
||||
peer_ids = [create_waku_id(services[peer]) for peer in peer_batch]
|
||||
for i in range(0, len(peers), system_variables.WAKU_INTERCONNECTION_BATCH):
|
||||
x = i
|
||||
peer_ids = [create_waku_id(services[peer]) for peer in peers[x:x+system_variables.WAKU_INTERCONNECTION_BATCH]]
|
||||
|
||||
connect_wakunode_to_peers(plan, waku_service_name, system_variables.WAKU_RPC_PORT_ID, peer_ids)
|
||||
|
||||
|
|
Loading…
Reference in New Issue