From ba0832588d570850e4e189f79eadd653aa6489ac Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 17 Feb 2023 08:08:43 -0500 Subject: [PATCH] *Refactor start --- src/index.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 58ba3c9..d50e8da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,8 +69,6 @@ export class SwarmClient extends Client { } async start(): Promise { - let ready = this.ready(); - const backoff = () => setImmediate(() => this._connectBackoff.backoff()); try { @@ -78,11 +76,10 @@ export class SwarmClient extends Client { } catch (e) { this.logErr(e); backoff(); + return; } - this.once("close", backoff); - - await ready; + await this.ready(); } public async addRelay(pubkey: string): Promise {