From 7ea424d024f6906fd9d5e882688f55b5608780eb Mon Sep 17 00:00:00 2001 From: styppo Date: Thu, 26 Jan 2023 22:28:57 +0000 Subject: [PATCH] Adjust request timeouts --- src/components/Feed/Feed.vue | 5 ++++- src/nostr/NostrClient.js | 2 +- src/nostr/NostrStore.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/Feed/Feed.vue b/src/components/Feed/Feed.vue index e6ab9e0..7c578a6 100644 --- a/src/components/Feed/Feed.vue +++ b/src/components/Feed/Feed.vue @@ -75,7 +75,10 @@ export default { : this.feed.filters this.stream = this.nostr.stream( filters, - {subId: `feed:${this.feed.name}`} + { + subId: `feed:${this.feed.name}`, + timeout: 3000, + } ) this.stream.on('init', notes => { const data = typeof this.feed.data === 'function' diff --git a/src/nostr/NostrClient.js b/src/nostr/NostrClient.js index a8105d3..5d6c032 100644 --- a/src/nostr/NostrClient.js +++ b/src/nostr/NostrClient.js @@ -65,7 +65,7 @@ export default class NostrClient { const sub = this.pool.subscribe(filters, opts.subId) const timer = setTimeout(() => { endCallback(Object.values(events)) - }, opts.timeout || 5000) + }, opts.timeout || 4000) sub.on('event', event => { events[event.id] = event }) diff --git a/src/nostr/NostrStore.js b/src/nostr/NostrStore.js index 0dc88fb..8f6a967 100644 --- a/src/nostr/NostrStore.js +++ b/src/nostr/NostrStore.js @@ -353,7 +353,7 @@ export const useNostrStore = defineStore('nostr', { console.log(`[TIMEOUT] stream ${sub.subId} (${values.length})`, filters) stream.emit('init', values) objects = null - }, opts.timeout || 5000) + }, opts.timeout || 4000) sub.on('end', () => { clearTimeout(timer)