change the default ping timeout to 3 seconds and make it configurable
This commit is contained in:
@ -113,6 +113,11 @@ Default::: `30000`
|
|||||||
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.
|
`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.
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,8 @@ Almost all of the methods on the client accept two arguments:
|
|||||||
[source,js]
|
[source,js]
|
||||||
-----------------
|
-----------------
|
||||||
client.ping({
|
client.ping({
|
||||||
requestTimeout: 1000,
|
requestTimeout: 30000,
|
||||||
|
|
||||||
// undocumented params are appended to the query string
|
// undocumented params are appended to the query string
|
||||||
hello: "elasticsearch!"
|
hello: "elasticsearch!"
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
|
|||||||
@ -220,7 +220,7 @@ module.exports = function (branch, done) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (name === 'ping') {
|
if (name === 'ping') {
|
||||||
spec.requestTimeout = 100;
|
spec.requestTimeout = 3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var urls = _.difference(def.url.paths, overrides.aliases[name]);
|
var urls = _.difference(def.url.paths, overrides.aliases[name]);
|
||||||
|
|||||||
@ -16,6 +16,7 @@ function ConnectionAbstract(host, config) {
|
|||||||
EventEmitter.call(this);
|
EventEmitter.call(this);
|
||||||
|
|
||||||
this.log = config.log || new Log();
|
this.log = config.log || new Log();
|
||||||
|
this.pingTimeout = config.pingTimeout || 3000;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new TypeError('Missing host');
|
throw new TypeError('Missing host');
|
||||||
@ -51,7 +52,7 @@ ConnectionAbstract.prototype.ping = function (params, cb) {
|
|||||||
cb = typeof cb === 'function' ? cb : null;
|
cb = typeof cb === 'function' ? cb : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var requestTimeout = 100;
|
var requestTimeout = this.pingTimeout;
|
||||||
var requestTimeoutId;
|
var requestTimeoutId;
|
||||||
var aborted;
|
var aborted;
|
||||||
var abort;
|
var abort;
|
||||||
|
|||||||
Reference in New Issue
Block a user