Retry a async function with a delay
重试异步函数并设置延迟
the function to retry
the options
Optional
the delay between retries, default is 0 - 重试间隔,默认为 0
the number of times to retry, default is 3 - 重试次数,默认 3
const result = await retry(async () => { return await fetch('https://example.com').then((res) => res.json())}, { limit: 3, delay: 1000 }) Copy
const result = await retry(async () => { return await fetch('https://example.com').then((res) => res.json())}, { limit: 3, delay: 1000 })
Retry a async function with a delay
重试异步函数并设置延迟