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 authored and simianhacker committed May 1, 2015
1 parent 4c9cd27 commit d37f90b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
22 changes: 18 additions & 4 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 @@ -34,9 +45,9 @@ try {
}

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 @@ -46,7 +57,10 @@ var config = module.exports = {
package : require(packagePath),
htpasswd : htpasswdPath,
buildNum : '@@buildNum',
maxSockets : kibana.maxSockets || Infinity
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 @@ -41,6 +41,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
3 changes: 2 additions & 1 deletion src/server/lib/waitForEs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var logger = require('./logger');
var config = require('../config');

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

logger.info('Unable to connect to elasticsearch at %s. Retrying in 2.5 seconds.', config.elasticsearch);
Expand Down

0 comments on commit d37f90b

Please sign in to comment.