From 0190ae94a7d79c5eecdadb6c946e41aa1fb06199 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 16 Mar 2024 13:32:33 -0300 Subject: [PATCH] Revert "fix: error thrown on ws close" This reverts commit e1bde08ff380e7f6ed2eed80e88e02124f8f0c79. --- abstract-relay.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/abstract-relay.ts b/abstract-relay.ts index 0315095..e0445bd 100644 --- a/abstract-relay.ts +++ b/abstract-relay.ts @@ -78,9 +78,9 @@ export class AbstractRelay { this.connectionPromise = new Promise((resolve, reject) => { this.connectionTimeoutHandle = setTimeout(() => { reject('connection timed out') + this.connectionPromise = undefined this.onclose?.() this.closeAllSubscriptions('relay connection timed out') - this.connectionPromise = undefined }, this.connectionTimeout) try { @@ -106,9 +106,9 @@ export class AbstractRelay { } this.ws.onclose = async () => { + this.connectionPromise = undefined this.onclose?.() this.closeAllSubscriptions('relay connection closed') - this.connectionPromise = undefined this._connected = false }