Skip to content

Commit

Permalink
Put default timeout back to zero
Browse files Browse the repository at this point in the history
Re: #26
Re: npm/cli#1151

The documented default timeout of 30s was not being set in v4, so we
"fixed the glitch" in v4.0.3, causing problems for people trying to
download large packages.

There's no npm v6 way to specify what timeout to use, so not having a
timeout at all seems like a reasonable default for the v4 line, at
least. Let's roll back that change, and document it. (Arguably, fixing
this bug was a breaking change, and we ought to roll it back.)

This effectively reverts 69c2977, with
documentation of the effective behavior before the change.

PR-URL: #27
Credit: @isaacs
Close: #27
Reviewed-by: @isaacs
  • Loading branch information
isaacs committed Apr 28, 2020
1 parent 2e0c446 commit fc5d94c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ See also [`opts.ca`](#opts-ca).
##### <a name="opts-timeout"></a> `opts.timeout`

* Type: Milliseconds
* Default: 30000 (30 seconds)
* Default: 0 (no timeout)

Time before a hanging request times out.

Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports = figgyPudding({
'spec': {},
'strict-ssl': {},
'timeout': {
default: 30 * 1000
default: 0
},
'user-agent': {
default: `${
Expand Down
2 changes: 1 addition & 1 deletion test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('isFromCI config option', t => {

test('default timeout', t => {
const DEFAULT_OPTS = config({})
t.equal(DEFAULT_OPTS.timeout, 30 * 1000, 'default timeout is 30s')
t.equal(DEFAULT_OPTS.timeout, 0, 'default timeout is 0 (no timeout)')
const SPECIFIED_OPTS = config({
timeout: 15 * 1000
})
Expand Down

0 comments on commit fc5d94c

Please sign in to comment.