Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'fetch-timeout' config #1870

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ packages.
The "maxTimeout" config for the `retry` module to use when fetching
packages.

#### fetch-timeout

* Default: 300000 (5 minutes)
* Type: Number

The maximum amount of time to wait for HTTP requests to complete.

#### fund

* Default: true
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const defaults = {
'fetch-retry-factor': 10,
'fetch-retry-mintimeout': 10000,
'fetch-retry-maxtimeout': 60000,
'fetch-timeout': 5 * 60 * 1000,

git: 'git',
'git-tag-version': true,
Expand Down Expand Up @@ -221,6 +222,7 @@ const types = {
'fetch-retry-factor': Number,
'fetch-retry-mintimeout': Number,
'fetch-retry-maxtimeout': Number,
'fetch-timeout': Number,
git: String,
'git-tag-version': Boolean,
'commit-hooks': Boolean,
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/flat-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({
minTimeout: npm.config.get('fetch-retry-mintimeout')
},

timeout: npm.config.get('fetch-timeout'),

force: npm.config.get('force'),

formatPackageLock: npm.config.get('format-package-lock'),
Expand Down
6 changes: 6 additions & 0 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Object {
"fetch-retry-factor": 10,
"fetch-retry-maxtimeout": 60000,
"fetch-retry-mintimeout": 10000,
"fetch-timeout": 300000,
"force": false,
"format-package-lock": true,
"fund": true,
Expand Down Expand Up @@ -336,6 +337,7 @@ Object {
"fetch-retry-factor": "{Number TYPE}",
"fetch-retry-maxtimeout": "{Number TYPE}",
"fetch-retry-mintimeout": "{Number TYPE}",
"fetch-timeout": "{Number TYPE}",
"force": "{Boolean TYPE}",
"format-package-lock": "{Boolean TYPE}",
"fund": "{Boolean TYPE}",
Expand Down Expand Up @@ -551,6 +553,7 @@ Object {
"fetch-retry-factor": 10,
"fetch-retry-maxtimeout": 60000,
"fetch-retry-mintimeout": 10000,
"fetch-timeout": 300000,
"force": false,
"format-package-lock": true,
"fund": true,
Expand Down Expand Up @@ -845,6 +848,7 @@ Object {
"fetch-retry-factor": "{Number TYPE}",
"fetch-retry-maxtimeout": "{Number TYPE}",
"fetch-retry-mintimeout": "{Number TYPE}",
"fetch-timeout": "{Number TYPE}",
"force": "{Boolean TYPE}",
"format-package-lock": "{Boolean TYPE}",
"fund": "{Boolean TYPE}",
Expand Down Expand Up @@ -1060,6 +1064,7 @@ Object {
"fetch-retry-factor": 10,
"fetch-retry-maxtimeout": 60000,
"fetch-retry-mintimeout": 10000,
"fetch-timeout": 300000,
"force": false,
"format-package-lock": true,
"fund": true,
Expand Down Expand Up @@ -1354,6 +1359,7 @@ Object {
"fetch-retry-factor": "{Number TYPE}",
"fetch-retry-maxtimeout": "{Number TYPE}",
"fetch-retry-mintimeout": "{Number TYPE}",
"fetch-timeout": "{Number TYPE}",
"force": "{Boolean TYPE}",
"format-package-lock": "{Boolean TYPE}",
"fund": "{Boolean TYPE}",
Expand Down
1 change: 1 addition & 0 deletions tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Object {
"strictSSL": "strict-ssl",
"tag": "tag",
"tagVersionPrefix": "tag-version-prefix",
"timeout": "fetch-timeout",
"tmp": "/tmp",
"umask": 18,
"unicode": undefined,
Expand Down
1 change: 1 addition & 0 deletions test/lib/utils/flat-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class MockConfig {
'fetch-retry-factor': 'fetch-retry-factor',
'fetch-retry-mintimeout': 'fetch-retry-mintimeout',
'fetch-retry-maxtimeout': 'fetch-retry-maxtimeout',
'fetch-timeout': 'fetch-timeout',
force: 'force',
'format-package-lock': 'format-package-lock',
fund: 'fund',
Expand Down