Skip to content

Commit

Permalink
Fix 100ms ping timeout. Closes #3643
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed Apr 28, 2015
1 parent ec45d1a commit bdf70d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
28 changes: 18 additions & 10 deletions src/server/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ function checkPath(path) {
}
}

// Set defaults for config file stuff
kibana.port = kibana.port || 5601;
kibana.host = kibana.host || '0.0.0.0';
kibana.elasticsearch_url = kibana.elasticsearch_url || 'http://localhost:9200';
kibana.maxSockets = kibana.maxSockets || Infinity;
kibana.log_file = kibana.log_file || null;

kibana.request_timeout = kibana.startup_timeout == null ? 0 : kibana.request_timeout;
kibana.ping_timeout = kibana.ping_timeout == null ? kibana.request_timeout : kibana.ping_timeout;
kibana.startup_timeout = kibana.startup_timeout == null ? 5000 : kibana.startup_timeout;

// Check if the local public folder is present. This means we are running in
// the NPM module. If it's not there then we are running in the git root.
var public_folder = path.resolve(__dirname, '..', 'public');
Expand All @@ -33,13 +44,10 @@ try {
packagePath = path.resolve(__dirname, '..', '..', '..', 'package.json');
}

var requestTimeout = kibana.request_timeout || 0;
var pingTimeout = kibana.ping_timeout == null ? requestTimeout : kibana.ping_timeout;

var config = module.exports = {
port : kibana.port || 5601,
host : kibana.host || '0.0.0.0',
elasticsearch : kibana.elasticsearch_url || 'http://localhost:9200',
port : kibana.port,
host : kibana.host,
elasticsearch : kibana.elasticsearch_url,
root : path.normalize(path.join(__dirname, '..')),
quiet : false,
public_folder : public_folder,
Expand All @@ -49,10 +57,10 @@ var config = module.exports = {
package : require(packagePath),
htpasswd : htpasswdPath,
buildNum : '@@buildNum',
maxSockets : kibana.maxSockets || Infinity,
log_file : kibana.log_file || null,
request_timeout : requestTimeout,
ping_timeout : pingTimeout
maxSockets : kibana.maxSockets,
log_file : kibana.log_file,
request_timeout : kibana.request_timeout,
ping_timeout : kibana.ping_timeout
};

config.plugins = listPlugins(config);
3 changes: 3 additions & 0 deletions src/server/config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ request_timeout: 300000
# Set to 0 to disable.
shard_timeout: 0

# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
# startup_timeout: 5000

# Set to false to have a complete disregard for the validity of the SSL
# certificate.
verify_ssl: true
Expand Down
2 changes: 1 addition & 1 deletion src/server/lib/waitForEs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var logger = require('./logger');
var config = require('../config');

function waitForPong() {
return client.ping()
return client.ping({requestTimeout: config.kibana.startup_timeout})
.catch(function (err) {
if (!(err instanceof NoConnections)) throw err;

Expand Down

0 comments on commit bdf70d3

Please sign in to comment.