added connect to ensureRelay if status != 1

This commit is contained in:
Egge
2023-03-06 09:42:32 +01:00
committed by fiatjaf_
parent b3d95cecdd
commit 73decbc8e0

View File

@@ -27,7 +27,12 @@ export class SimplePool {
async ensureRelay(url: string): Promise<Relay> {
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,