From ea98869a128f30bb2301d07d30c0ed8cca7af0f6 Mon Sep 17 00:00:00 2001 From: acolytec3 <17355484+acolytec3@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:19:42 -0500 Subject: [PATCH] ping all bootnodes at once (#685) --- packages/portalnetwork/src/client/client.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/portalnetwork/src/client/client.ts b/packages/portalnetwork/src/client/client.ts index 9b8f0ef83..e4d44f85e 100644 --- a/packages/portalnetwork/src/client/client.ts +++ b/packages/portalnetwork/src/client/client.ts @@ -277,17 +277,13 @@ export class PortalNetwork extends (EventEmitter as { new (): PortalNetworkEvent * Tries to connect to any pre-configured bootnodes */ public bootstrap = async () => { + const boostrapRequests = [] for (const network of this.networks) { for (const enr of this.bootnodes) { - try { - await network[1].addBootNode(enr) - network[1].logger(`Added bootnode ${enr} to ${network[1].networkId}`) - } catch (error: any) { - throw new Error(`Error adding bootnode ${enr} to network \ - ${network[1].networkId}: ${error.message ?? error}`) - } + boostrapRequests.push(network[1].addBootNode(enr)) } } + void Promise.all(boostrapRequests) } /** * Stops the portal network client and cleans up listeners