Remove call to pingCluster with only one server

If only one server is used, the amount of requests can be reduced from a
minimum of two to a minimum of one. In most cases this cuts down the
response time in half.
This commit is contained in:
Markus Mäkelä 2018-07-03 01:57:14 +03:00
parent 75c5a5dca5
commit d96a8b1773
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -377,13 +377,15 @@ function getTable(headobj) {
function pingCluster(hosts) {
var promises = []
hosts.forEach(function(i) {
args = {}
args.uri = getUri(i, this.argv.secure, '')
args.json = true
setTlsCerts(args)
promises.push(request(args))
})
if (hosts.length > 1 ) {
hosts.forEach(function(i) {
args = {}
args.uri = getUri(i, this.argv.secure, '')
args.json = true
setTlsCerts(args)
promises.push(request(args))
})
}
return Promise.all(promises)
}