From 4c02c4ea0249dd50eeee2b544fc853d0e109f827 Mon Sep 17 00:00:00 2001 From: acul71 <34693171+acul71@users.noreply.github.com> Date: Wed, 30 Apr 2025 09:46:12 +0000 Subject: [PATCH] doc: add TODO for limit concurrency --- libp2p/identity/identify_push/identify_push.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libp2p/identity/identify_push/identify_push.py b/libp2p/identity/identify_push/identify_push.py index d8a8efb9..883b63de 100644 --- a/libp2p/identity/identify_push/identify_push.py +++ b/libp2p/identity/identify_push/identify_push.py @@ -185,6 +185,10 @@ async def push_identify_to_peers( peer_ids = set(host.get_peerstore().peer_ids()) # Push to each peer in parallel using a trio.Nursery + # TODO: Consider using a bounded nursery to limit concurrency + # and avoid overwhelming the network. This can be done by using + # trio.open_nursery(max_concurrent=10) or similar. + # For now, we will use an unbounded nursery for simplicity. async with trio.open_nursery() as nursery: for peer_id in peer_ids: nursery.start_soon(push_identify_to_peer, host, peer_id, observed_multiaddr)