0
Fork 0
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:
Alex Kocharin 2014-03-08 04:00:07 +00:00
parent f1ec18dc4b
commit 6a2a463b76

View file

@ -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
}