Repository navigation
Open
Description
Timeouts do not cause a retry. That is not clear from the documentation. Many examples look like the following (copied from quick start)
const api = createClient({ timeout: 5000, retries: 2 })
const response = await api('https://api.example.com/users')I interpreted this as, if after 5s no response received, retry it two more times (three times in total).
But in fact, ffetch doesn't retry at all once the timeout is reached. I do not know if this is a bug or expected behavior :-)
Can you make it a bit clearer in the documentation what the exptected retry behavior for timeouts is?
Maybe elaborate a bit on the decision why you choose a certain behavior.
An example how to configure the client to retry on Timeouts can be helpful for new users.
The default decision when to retry seems to be implemented here:
Lines 4 to 14 in ea5a184
| export function shouldRetry(ctx: RetryContext): boolean { | |
| const { error, response } = ctx | |
| if ( | |
| error instanceof AbortError || | |
| error instanceof CircuitOpenError || | |
| error instanceof TimeoutError | |
| ) | |
| return false | |
| if (!response) return true // network error | |
| return response.status >= 500 || response.status === 429 | |
| } |
Metadata
Metadata
Assignees
Labels
No labels
Activity
atombrenner commentedon Nov 17, 2026
Update: It seems that the
timeoutoption increateClientis the overall timeout, including all retries, and not the timeout per attempt. It seems to me it is impossible to have a retry-after-timeout with ffetch, can you confirm this?