mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 14:44:26 +01:00
fix: increase relay fetch timeout from 3s to 5s
Relays can be slow, especially on first connection. Increase timeout to 5 seconds to give relays more time to respond before falling back to default metadata.
This commit is contained in:
@@ -32,10 +32,10 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
|
||||
console.log(`Cache miss for ${naddr}, fetching from relays...`)
|
||||
|
||||
try {
|
||||
// Fetch with 3 second timeout
|
||||
// Fetch with 5 second timeout (relays can be slow)
|
||||
const relayPromise = fetchArticleMetadataViaRelays(naddr)
|
||||
const timeoutPromise = new Promise<null>((resolve) => {
|
||||
setTimeout(() => resolve(null), 3000)
|
||||
setTimeout(() => resolve(null), 5000)
|
||||
})
|
||||
|
||||
meta = await Promise.race([relayPromise, timeoutPromise])
|
||||
|
||||
Reference in New Issue
Block a user