mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 00:28:51 +00:00
added connect to ensureRelay if status != 1
This commit is contained in:
7
pool.ts
7
pool.ts
@@ -27,7 +27,12 @@ export class SimplePool {
|
|||||||
async ensureRelay(url: string): Promise<Relay> {
|
async ensureRelay(url: string): Promise<Relay> {
|
||||||
const nm = normalizeURL(url)
|
const nm = normalizeURL(url)
|
||||||
const existing = this._conn[nm]
|
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, {
|
const relay = relayInit(nm, {
|
||||||
getTimeout: this.getTimeout * 0.9,
|
getTimeout: this.getTimeout * 0.9,
|
||||||
|
|||||||
Reference in New Issue
Block a user