mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
count each failed request only once
This commit is contained in:
parent
f1ec18dc4b
commit
6a2a463b76
1 changed files with 11 additions and 3 deletions
|
@ -167,11 +167,19 @@ Storage.prototype.request = function(options, cb) {
|
|||
}, msg)
|
||||
if (cb) cb.apply(self, arguments)
|
||||
})
|
||||
|
||||
var status_called = false
|
||||
req.on('response', function(res) {
|
||||
if (!req._sinopia_aborted) self.status_check(true)
|
||||
if (!req._sinopia_aborted && !status_called) {
|
||||
status_called = true
|
||||
self.status_check(true)
|
||||
}
|
||||
})
|
||||
req.on('error', function() {
|
||||
if (!req._sinopia_aborted) self.status_check(false)
|
||||
req.on('error', function(err) {
|
||||
if (!req._sinopia_aborted && !status_called) {
|
||||
status_called = true
|
||||
self.status_check(false)
|
||||
}
|
||||
})
|
||||
return req
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue