Conversation
Thomas-Heniart
left a comment
There was a problem hiding this comment.
Just a minor suggestion
Co-authored-by: Thomas Heniart <heniart.thomas@gmail.com>
|
|
||
| async _request (url, reqOpts, transformer, cb) { | ||
| let timeoutId | ||
| reqOpts.timeout = 0 |
There was a problem hiding this comment.
why are we forcing this to 0? and working with this._timeout?
There was a problem hiding this comment.
I think how we can do is this:
const timeout = reqOpts.timeout || this._timeout || BASE_TIMEOUT
delete reqOpts.timeoutthis way you don't break anything and you can do patch release instead of mayor
There was a problem hiding this comment.
this._timeout already takes into account BASE_TIMEOUT
user-set timeout is passed only on instance creation and stored in this._timeout, which is later used as reqOpts.timeout, for instance here. this._timeout is already used as reqOpts.timeout everywhere, not sure why it's been implemented like this honestly.
lastly, it is major release because we bump node version. Earlier versions don't have abort controller.
There was a problem hiding this comment.
my point is you're taking ability of user to set it's own timeout, we can still support that with this:
const timeout = reqOpts.timeout || this._timeout
delete reqOpts.timeout
if (this._timeout > 0) {
...
}so it allows to set custom timeout per request but also supports default one
Description:
use abort controller to avoid infinite response await for cases when connection could not be established
replace timeout logic with AbortController, see docs
Breaking changes:
New features:
Fixes:
PR status: