-
-
Notifications
You must be signed in to change notification settings - Fork 660
Open
Labels
enhancementNew feature or requestNew feature or request
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)
}
})
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request