Fix slow loading and NIP-07 decryption issues

- Reduced `fetchListIncrementally` timeout to 4000ms to fail faster on bad relays.
- Added 15s timeout to decryption calls in `HashtagPreferencesService`, `UserBlockListManager`, and `SubscriptionsManager` to prevent infinite hangs.
- Added handling for "message channel closed" error in `nip07Adapter` with a backoff delay to allow extension recovery.
- Prioritized preserving cached data on decryption failure instead of resetting to empty state.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-27 18:51:34 +00:00
1 parent 8b9ef3858d
commit dab94a5cfe
5 files changed
+45 -6

No files matched your search

+14 -1
View File
@@ -467,7 +467,20 @@ class SubscriptionsManager {
return;
}
const decryptResult = await this.decryptSubscriptionEvent(newest, userPubkey);
let decryptResult;
try {
const decryptPromise = this.decryptSubscriptionEvent(newest, userPubkey);
const timeoutPromise = new Promise((_, reject) =>
setTimeout(
() => reject(new Error("Decryption timed out after 15s")),
15000,
),
);
decryptResult = await Promise.race([decryptPromise, timeoutPromise]);
} catch (error) {
decryptResult = { ok: false, error };
}
if (!decryptResult.ok) {
userLogger.error(
"[SubscriptionsManager] Failed to decrypt subscription list:",