Retry & Timeout

Retry with backoff and timeout utilities.

1 min readEdit this page

Retry

import { retry } from '@restjs/circuit'
 
const data = await retry(() => fetchAPI(), {
  attempts: 3,
  delay: 1000,
  backoff: 'exponential'
})

Timeout

import { withTimeout } from '@restjs/circuit'
 
const result = await withTimeout(fetch(url), 5000, 'Request timed out')