mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
fix: resolve decryption timeouts and listener warnings
Increases NIP-07 concurrency to 3 and lowers priority for non-critical decryption tasks to prevent blocklist timeouts. Increases relay max listeners to 200 to mitigate warnings. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
b8143435a3
commit
849e00a2ff
5 files changed
+22
-16
No files matched your search
+7
-3
@@ -4654,13 +4654,17 @@ export class NostrClient {
|
||||
const relay = await originalEnsureRelay(url);
|
||||
if (relay && typeof relay.setMaxListeners === "function") {
|
||||
try {
|
||||
relay.setMaxListeners(100);
|
||||
relay.setMaxListeners(200);
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return relay;
|
||||
};
|
||||
} else {
|
||||
devLogger.warn(
|
||||
"[nostr] SimplePool.ensureRelay missing; max listeners patch skipped."
|
||||
);
|
||||
}
|
||||
|
||||
shimLegacySimplePoolMethods(instance);
|
||||
@@ -5170,7 +5174,7 @@ export class NostrClient {
|
||||
(pubkey, ciphertext, options) =>
|
||||
activeSigner.nip44Decrypt(pubkey, ciphertext, {
|
||||
...options,
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
}),
|
||||
{
|
||||
priority: -20,
|
||||
@@ -5188,7 +5192,7 @@ export class NostrClient {
|
||||
(pubkey, ciphertext, options) =>
|
||||
activeSigner.nip04Decrypt(pubkey, ciphertext, {
|
||||
...options,
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
}),
|
||||
{
|
||||
priority: -10,
|
||||
|
||||
@@ -99,7 +99,7 @@ class Nip07RequestQueue {
|
||||
// This prevents "message channel closed" errors caused by race conditions
|
||||
// when multiple components (blocks, DMs, auth) query the extension simultaneously,
|
||||
// while allowing critical tasks (e.g. blocklist decryption) to jump the line.
|
||||
const requestQueue = new Nip07RequestQueue(2);
|
||||
const requestQueue = new Nip07RequestQueue(3);
|
||||
|
||||
export function getEnableVariantTimeoutMs() {
|
||||
const overrideValue =
|
||||
|
||||
@@ -951,7 +951,7 @@ class HashtagPreferencesService {
|
||||
// get more time because the user may be approving a popup.
|
||||
const nip07DecryptTimeoutMs = allowPermissionPrompt ? 15000 : 5000;
|
||||
const signerDecryptOptions = {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
timeoutMs: nip07DecryptTimeoutMs,
|
||||
retryMultiplier: 1,
|
||||
};
|
||||
@@ -981,7 +981,7 @@ class HashtagPreferencesService {
|
||||
}
|
||||
|
||||
const extensionDecryptOptions = {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
timeoutMs: nip07DecryptTimeoutMs,
|
||||
retryMultiplier: 1,
|
||||
};
|
||||
|
||||
+2
-2
@@ -970,7 +970,7 @@ class SubscriptionsManager {
|
||||
// loads get more time because the user may be approving a popup.
|
||||
const nip07DecryptTimeoutMs = allowPermissionPrompt ? 15000 : 5000;
|
||||
const signerDecryptOptions = {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
timeoutMs: nip07DecryptTimeoutMs,
|
||||
retryMultiplier: 1,
|
||||
};
|
||||
@@ -992,7 +992,7 @@ class SubscriptionsManager {
|
||||
|
||||
if (nostrApi) {
|
||||
const decrypterOptions = {
|
||||
priority: NIP07_PRIORITY.HIGH,
|
||||
priority: NIP07_PRIORITY.NORMAL,
|
||||
timeoutMs: nip07DecryptTimeoutMs,
|
||||
retryMultiplier: 1,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user