commit
9a8e7dd525
|
@ -15,11 +15,27 @@ function waitForPong() {
|
|||
}
|
||||
|
||||
function waitForShards() {
|
||||
return client.cluster.health().then(function (resp) {
|
||||
if (resp.initializing_shards <= 0) return;
|
||||
return client.cluster.health({
|
||||
timeout: '5s', // tells es to not sit around and wait forever
|
||||
index: config.kibana.kibana_index
|
||||
})
|
||||
.then(function (resp) {
|
||||
// if "timed_out" === true then elasticsearch could not
|
||||
// find any idices matching our filter within 5 seconds
|
||||
if (resp.timed_out) {
|
||||
logger.info('No existing kibana index found');
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info('Elasticsearch is still initializaing... Trying again in 2500 seconds.');
|
||||
return Promise.delay(2500).then(waitForShards);
|
||||
// If status === "red" that means that index(es) were found
|
||||
// but the shards are not ready for queries
|
||||
if (resp.status === 'red') {
|
||||
logger.info('Elasticsearch is still initializing the kibana index... Trying again in 2.5 second.');
|
||||
return Promise.delay(2500).then(waitForShards);
|
||||
}
|
||||
|
||||
// otherwise we are g2g
|
||||
logger.info('Found kibana index');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('kibana_server', function (keepalive) {
|
||||
var done = this.async();
|
||||
var config = require('../src/server/config');
|
||||
config.quiet = true;
|
||||
config.quiet = !grunt.option('debug') && !grunt.option('verbose');
|
||||
var server = require('../src/server');
|
||||
|
||||
server.start(function (err) {
|
||||
|
|
Loading…
Reference in a new issue