Adjust request timeouts

This commit is contained in:
styppo 2023-01-26 22:28:57 +00:00
parent e0bb92cce2
commit 7ea424d024
No known key found for this signature in database
GPG Key ID: 3AAA685C50724C28
3 changed files with 6 additions and 3 deletions

View File

@ -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'

View File

@ -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
})

View File

@ -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)