From 73decbc8e093705f71e2bc6fc0bf0eadb99b9d78 Mon Sep 17 00:00:00 2001 From: Egge <80262989+Egge7@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:42:32 +0100 Subject: [PATCH] added connect to ensureRelay if status != 1 --- pool.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pool.ts b/pool.ts index 24a89bc..18a9edb 100644 --- a/pool.ts +++ b/pool.ts @@ -27,7 +27,12 @@ export class SimplePool { async ensureRelay(url: string): Promise { const nm = normalizeURL(url) const existing = this._conn[nm] - if (existing) return existing + if (existing && existing.status === 1) return existing + + if (existing) { + await existing.connect(); + return existing + } const relay = relayInit(nm, { getTimeout: this.getTimeout * 0.9,