mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 21:32:51 +00:00
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:
1 parent
8b9ef3858d
commit
dab94a5cfe
5 files changed
+45
-6
No files matched your search
@@ -588,7 +588,20 @@ class HashtagPreferencesService {
|
||||
return;
|
||||
}
|
||||
|
||||
const decryptResult = await this.decryptEvent(latest, normalized);
|
||||
let decryptResult;
|
||||
try {
|
||||
const decryptPromise = this.decryptEvent(latest, normalized);
|
||||
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.warn(
|
||||
`${LOG_PREFIX} Failed to decrypt hashtag preferences`,
|
||||
|
||||
Reference in new issue
Block a user