From edaf47ea356b99b042746e2c5bab6d6ece8284a2 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 10 Oct 2024 14:38:12 -0700 Subject: [PATCH] bump versions --- packages/app/package.json | 4 ++-- packages/app/src/storage.ts | 1 + packages/app/src/thunk.ts | 2 -- packages/net/package.json | 2 +- packages/net/src/Connection.ts | 10 +++++++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index 1ad907c..9c54dfe 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/app", - "version": "0.0.13", + "version": "0.0.14", "author": "hodlbod", "license": "MIT", "description": "A collection of svelte stores for use in building nostr client applications.", @@ -34,7 +34,7 @@ "@welshman/lib": "~0.0.21", "@welshman/feeds": "~0.0.20", "@welshman/dvm": "~0.0.10", - "@welshman/net": "~0.0.25", + "@welshman/net": "~0.0.26", "@welshman/signer": "~0.0.8", "@welshman/store": "~0.0.10", "@welshman/util": "~0.0.38", diff --git a/packages/app/src/storage.ts b/packages/app/src/storage.ts index 40f9763..53b7de5 100644 --- a/packages/app/src/storage.ts +++ b/packages/app/src/storage.ts @@ -199,3 +199,4 @@ export const storageAdapters = { }), }), } + diff --git a/packages/app/src/thunk.ts b/packages/app/src/thunk.ts index 079e279..6d5fd5a 100644 --- a/packages/app/src/thunk.ts +++ b/packages/app/src/thunk.ts @@ -105,8 +105,6 @@ export type ThunkParams = { relays: string[] } -export const makeThunk = (params: ThunkParams) => params - export const publishThunk = (params: ThunkParams) => new Promise(resolve => { const event = prepEvent(params.event) diff --git a/packages/net/package.json b/packages/net/package.json index a61f487..3ae3fae 100644 --- a/packages/net/package.json +++ b/packages/net/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/net", - "version": "0.0.25", + "version": "0.0.26", "author": "hodlbod", "license": "MIT", "description": "Utilities for connecting with nostr relays.", diff --git a/packages/net/src/Connection.ts b/packages/net/src/Connection.ts index def9c10..1d4c9bf 100644 --- a/packages/net/src/Connection.ts +++ b/packages/net/src/Connection.ts @@ -96,7 +96,7 @@ export class Connection extends Emitter { this.emit('receive', this, message) } - ensureConnected = async ({shouldReconnect = true}) => { + ensureConnected = async ({shouldReconnect = true} = {}) => { const isUnhealthy = this.socket.isClosing() || this.socket.isClosed() const noRecentFault = this.meta.lastFault < Date.now() - 60_000 @@ -107,10 +107,14 @@ export class Connection extends Emitter { if (this.socket.isNew()) { await this.socket.connect() } + + while (this.socket.isConnecting()) { + await sleep(100) + } } - ensureAuth = async ({timeout = 3000}) => { - await this.ensureConnected({shouldReconnect: true}) + ensureAuth = async ({timeout = 3000} = {}) => { + await this.ensureConnected() if (this.meta.authStatus === AuthStatus.Pending) { await Promise.race([