mirror of
https://github.com/hoornet/vega.git
synced 2026-05-07 04:39:12 -07:00
Increase mention fetch timeout and retry on empty
Tag-based #p queries are slower on some relays. Increase timeout from 8s to 12s for fetchMentions. Also retry once after 3s if the initial notification fetch returns empty (helps on cold start when relays need time to connect).
This commit is contained in:
@@ -74,10 +74,11 @@ export async function fetchFollowSuggestions(myFollows: string[]): Promise<{ pub
|
||||
|
||||
export async function fetchMentions(pubkey: string, since: number, limit = 50): Promise<NDKEvent[]> {
|
||||
const instance = getNDK();
|
||||
// Use a longer timeout for #p queries — some relays are slow to index tag lookups
|
||||
const events = await fetchWithTimeout(
|
||||
instance,
|
||||
{ kinds: [NDKKind.Text], "#p": [pubkey], since, limit },
|
||||
FEED_TIMEOUT,
|
||||
12000,
|
||||
);
|
||||
return Array.from(events).sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user