fix(ai): prevent test timeouts in subscriptions (agent) suggested

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-10 00:28:27 +00:00
1 parent 61213371c8
commit aebb667d1c
2 files changed
+11 -5

No files matched your search

+10 -5
View File
@@ -913,15 +913,20 @@ class SubscriptionsManager {
// scheme × up to 3 schemes = ~18s) = ~30s. Reduced from 45s to prevent
// blocking the login path for nearly a minute.
const timeoutMs = 25000;
let timeoutId;
await Promise.race([
loader,
new Promise((_, reject) =>
setTimeout(
new Promise((_, reject) => {
timeoutId = setTimeout(
() => reject(new Error("Timeout loading subscriptions")),
timeoutMs
)
),
]);
);
}),
]).finally(() => {
if (timeoutId) {
clearTimeout(timeoutId);
}
});
devLogger.log("[SubscriptionsManager] ensureLoaded success");
return { ok: this.dataReady === true, error: this.lastLoadError || null, state: this.getLoadState() };
} catch (error) {
+1
View File
@@ -619,6 +619,7 @@ test(
"retry with permission prompts should populate subscriptions",
);
} finally {
manager.reset();
relayManager.setEntries(originalRelayEntries, { allowEmpty: false, updateClient: false });
nostrClient.relays = originalRelays;
nostrClient.writeRelays = originalWriteRelays;