change the default ping timeout to 3 seconds and make it configurable

This commit is contained in:
Spencer Alger
2015-03-26 12:34:09 -07:00
parent 9a447943a4
commit 307dc44316
4 changed files with 10 additions and 3 deletions

View File

@ -113,6 +113,11 @@ Default::: `30000`
Default::: `30000`
`pingTimeout`[[config-ping-timeout]]:: `Number` -- Milliseconds that a ping request can take before timing out.
Default::: `3000`
`keepAlive`[[config-keep-alive]]:: `Boolean` -- Should the connections to the node be kept open forever? This behavior is recommended when you are connecting directly to Elasticsearch.

View File

@ -26,7 +26,8 @@ Almost all of the methods on the client accept two arguments:
[source,js]
-----------------
client.ping({
requestTimeout: 1000,
requestTimeout: 30000,
// undocumented params are appended to the query string
hello: "elasticsearch!"
}, function (error) {

View File

@ -220,7 +220,7 @@ module.exports = function (branch, done) {
}
if (name === 'ping') {
spec.requestTimeout = 100;
spec.requestTimeout = 3000;
}
var urls = _.difference(def.url.paths, overrides.aliases[name]);

View File

@ -16,6 +16,7 @@ function ConnectionAbstract(host, config) {
EventEmitter.call(this);
this.log = config.log || new Log();
this.pingTimeout = config.pingTimeout || 3000;
if (!host) {
throw new TypeError('Missing host');
@ -51,7 +52,7 @@ ConnectionAbstract.prototype.ping = function (params, cb) {
cb = typeof cb === 'function' ? cb : null;
}
var requestTimeout = 100;
var requestTimeout = this.pingTimeout;
var requestTimeoutId;
var aborted;
var abort;