mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 03:19:36 +01:00
Adding a configurable timeout for each uplink
This commit is contained in:
parent
75e78b4137
commit
1d109f8071
@ -12,6 +12,10 @@ uplinks:
|
||||
npmjs:
|
||||
url: https://registry.npmjs.org/
|
||||
|
||||
# amount of time to wait for repository to respond before giving up
|
||||
# and use the local cached copy
|
||||
timeout: 3000
|
||||
|
||||
# maximum time (in seconds) in which data is considered up to date
|
||||
#
|
||||
# default is 2 minutes, so server won't request the same data from
|
||||
|
@ -32,6 +32,9 @@ function Storage(config, mainconfig) {
|
||||
_setupProxy.call(this, this.url.hostname, config, mainconfig, this.url.protocol === 'https:')
|
||||
|
||||
this.config.url = this.config.url.replace(/\/$/, '')
|
||||
if (isNaN(parseFloat(this.config.timeout)) || !isFinite(this.config.timeout)) {
|
||||
this.config.timeout = 5000
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
@ -105,6 +108,7 @@ Storage.prototype.request = function(options, cb) {
|
||||
body: json,
|
||||
ca: this.ca,
|
||||
proxy: this.proxy,
|
||||
timeout: this.config.timeout
|
||||
}, function(err, res, body) {
|
||||
var error
|
||||
if (!err) {
|
||||
|
Loading…
Reference in New Issue
Block a user