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:
@ -377,6 +377,7 @@ function getTable(headobj) {
|
|||||||
function pingCluster(hosts) {
|
function pingCluster(hosts) {
|
||||||
var promises = []
|
var promises = []
|
||||||
|
|
||||||
|
if (hosts.length > 1 ) {
|
||||||
hosts.forEach(function(i) {
|
hosts.forEach(function(i) {
|
||||||
args = {}
|
args = {}
|
||||||
args.uri = getUri(i, this.argv.secure, '')
|
args.uri = getUri(i, this.argv.secure, '')
|
||||||
@ -384,6 +385,7 @@ function pingCluster(hosts) {
|
|||||||
setTlsCerts(args)
|
setTlsCerts(args)
|
||||||
promises.push(request(args))
|
promises.push(request(args))
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user