From 3a090cdfd60e8d4ce726352374ac67ffc79ddb1f Mon Sep 17 00:00:00 2001 From: enes Date: Fri, 20 Sep 2024 17:35:19 +0200 Subject: [PATCH] fix: nostr discovery timeout --- src/utils/nostr.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index ec42325..540bcc9 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -790,11 +790,21 @@ const getUserAppDataFromBlossom = async (url: string, privateKey: string) => { errorCode = status } + // HACK: Timeout issue, blossom server nostr discovery + // Force the error code as the timeout + if ( + errorCode === 0 && + axios.isAxiosError(err) && + err.code === 'ERR_NETWORK' + ) { + errorCode = 504 + } + return null }) // Return a default value if the requested resource is not found (404) - if (errorCode === 404) { + if (errorCode === 404 || errorCode === 504) { return { sigits: {}, processedGiftWraps: []