From d2fd8fb8fe1ab319ccdd73e097c0986bf19ae3ff Mon Sep 17 00:00:00 2001 From: Gigi Date: Fri, 17 Oct 2025 20:40:07 +0200 Subject: [PATCH] perf: remove 30s timeout from bookmark decryption The withTimeout wrapper was causing decrypt operations to wait 30 seconds before failing, even when bunker rejection was instant. Now uses the same direct approach as the debug page encryption tests: - No artificial timeouts - Fast natural failures - Should reduce decrypt time from 30s+ to near-instant Fixes slow bookmark loading when bunker doesn't support nip44. --- src/services/bookmarkProcessing.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/services/bookmarkProcessing.ts b/src/services/bookmarkProcessing.ts index 43cb0674..d47557e7 100644 --- a/src/services/bookmarkProcessing.ts +++ b/src/services/bookmarkProcessing.ts @@ -5,7 +5,7 @@ import { } from '../types/bookmarks' import { BookmarkHiddenSymbol, hasNip04Decrypt, hasNip44Decrypt, processApplesauceBookmarks } from './bookmarkHelpers' import type { NostrEvent } from './bookmarkHelpers' -import { withTimeout, mapWithConcurrency } from '../utils/async' +import { mapWithConcurrency } from '../utils/async' type DecryptFn = (pubkey: string, content: string) => Promise type UnlockHiddenTagsFn = typeof Helpers.unlockHiddenTags @@ -39,10 +39,7 @@ async function decryptEvent( let decryptedContent: string | undefined try { if (hasNip44Decrypt(signerCandidate)) { - decryptedContent = await withTimeout( - (signerCandidate as { nip44: { decrypt: DecryptFn } }).nip44.decrypt(evt.pubkey, evt.content), - 30000 - ) + decryptedContent = await (signerCandidate as { nip44: { decrypt: DecryptFn } }).nip44.decrypt(evt.pubkey, evt.content) } } catch (err) { console.log("[bunker] ❌ nip44.decrypt failed:", err instanceof Error ? err.message : String(err)) @@ -51,10 +48,7 @@ async function decryptEvent( if (!decryptedContent) { try { if (hasNip04Decrypt(signerCandidate)) { - decryptedContent = await withTimeout( - (signerCandidate as { nip04: { decrypt: DecryptFn } }).nip04.decrypt(evt.pubkey, evt.content), - 30000 - ) + decryptedContent = await (signerCandidate as { nip04: { decrypt: DecryptFn } }).nip04.decrypt(evt.pubkey, evt.content) } } catch (err) { console.log("[bunker] ❌ nip04.decrypt failed:", err instanceof Error ? err.message : String(err))