mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
🍙 added timeout to resolver api request
This commit is contained in:
parent
de43b990f2
commit
6721966e5b
1 changed files with 6 additions and 1 deletions
|
@ -53,7 +53,12 @@ export async function resolveById(params: Paramaters, progressCallback?: (progre
|
|||
publicKey
|
||||
}))
|
||||
|
||||
const apiResponse = await fetch(url.toString(), { cache: 'no-store' })
|
||||
const controller = new AbortController()
|
||||
// 5 second timeout:
|
||||
const timeoutId = setTimeout(() => controller.abort(), 5000)
|
||||
const apiResponse = await fetch(url.toString(), { cache: 'no-store', signal: controller.signal })
|
||||
clearTimeout(timeoutId)
|
||||
|
||||
if (apiResponse.ok) {
|
||||
const response: ApiResponse = await apiResponse.json()
|
||||
for (const item of params) {
|
||||
|
|
Loading…
Add table
Reference in a new issue