mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 11:52:25 +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
+12
-1
@@ -1011,10 +1011,21 @@ class UserBlockListManager {
|
||||
let decryptionError = null;
|
||||
|
||||
try {
|
||||
const [muteList, blockList] = await Promise.all([
|
||||
const decryptPromise = Promise.all([
|
||||
decryptEvent(newestMute),
|
||||
decryptEvent(newestBlock),
|
||||
]);
|
||||
const timeoutPromise = new Promise((_, reject) =>
|
||||
setTimeout(
|
||||
() => reject(new Error("Decryption timed out after 15s")),
|
||||
15000,
|
||||
),
|
||||
);
|
||||
|
||||
const [muteList, blockList] = await Promise.race([
|
||||
decryptPromise,
|
||||
timeoutPromise,
|
||||
]);
|
||||
|
||||
muteList.forEach((pk) => mergedPubkeys.add(pk));
|
||||
blockList.forEach((pk) => mergedPubkeys.add(pk));
|
||||
|
||||
Reference in new issue
Block a user