retry-handler should pass any error to retry method
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
if we pass AbortSignal with timeout, to limit the request time, in case of a timeout, the controller will be aborted in this case, retry handler assumes there is no reason to retry the request.
I want to move the decision to the user, the user may decide to mutate the "opts", pass new AbortSignal, and retry the request.
The implementation should look like...
Need to change
if (controller?.aborted || isDisturbed(this.opts.body)) {
this.handler.onResponseError?.(controller, err)
return
}
to
if (isDisturbed(this.opts.body)) {
this.handler.onResponseError?.(controller, err)
return
}
then use can do
new RetryAgent(new Agent(), {
retry: (err, { state, opts }, cb) => {
if (err.code === DOMException.TIMEOUT_ERR)
opts.signal = AbortSignal.timeout(...)
cb()
return
}
cb(err)
}
})
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the retry-handler condition that checks controller?.aborted and isDisturbed(this.opts.body), then read how RetryAgent invokes the retry callback. Done means errors from an aborted controller reach the user retry method unless the request body is disturbed, allowing the callback to replace opts.signal and retry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100