mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Adjust request timeouts
This commit is contained in:
parent
e0bb92cce2
commit
7ea424d024
@ -75,7 +75,10 @@ export default {
|
|||||||
: this.feed.filters
|
: this.feed.filters
|
||||||
this.stream = this.nostr.stream(
|
this.stream = this.nostr.stream(
|
||||||
filters,
|
filters,
|
||||||
{subId: `feed:${this.feed.name}`}
|
{
|
||||||
|
subId: `feed:${this.feed.name}`,
|
||||||
|
timeout: 3000,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
this.stream.on('init', notes => {
|
this.stream.on('init', notes => {
|
||||||
const data = typeof this.feed.data === 'function'
|
const data = typeof this.feed.data === 'function'
|
||||||
|
@ -65,7 +65,7 @@ export default class NostrClient {
|
|||||||
const sub = this.pool.subscribe(filters, opts.subId)
|
const sub = this.pool.subscribe(filters, opts.subId)
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
endCallback(Object.values(events))
|
endCallback(Object.values(events))
|
||||||
}, opts.timeout || 5000)
|
}, opts.timeout || 4000)
|
||||||
sub.on('event', event => {
|
sub.on('event', event => {
|
||||||
events[event.id] = event
|
events[event.id] = event
|
||||||
})
|
})
|
||||||
|
@ -353,7 +353,7 @@ export const useNostrStore = defineStore('nostr', {
|
|||||||
console.log(`[TIMEOUT] stream ${sub.subId} (${values.length})`, filters)
|
console.log(`[TIMEOUT] stream ${sub.subId} (${values.length})`, filters)
|
||||||
stream.emit('init', values)
|
stream.emit('init', values)
|
||||||
objects = null
|
objects = null
|
||||||
}, opts.timeout || 5000)
|
}, opts.timeout || 4000)
|
||||||
|
|
||||||
sub.on('end', () => {
|
sub.on('end', () => {
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
|
Loading…
Reference in New Issue
Block a user