diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index b9429a2a..31872ede 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -187,19 +187,18 @@ var CartodbWindshaft = function(serverOptions) { * END Routing ******************************************************************************************************************/ - var healthCheck = new HealthCheck(cartoData, Windshaft.tilelive); + var healthCheck = new HealthCheck(global.environment.disabled_file); ws.get('/health', function(req, res) { var healthConfig = global.environment.health || {}; if (!!healthConfig.enabled) { var startTime = Date.now(); - healthCheck.check(healthConfig, function(err, result) { + healthCheck.check(healthConfig, function(err) { var ok = !err; var response = { enabled: true, ok: ok, - elapsed: Date.now() - startTime, - result: result + elapsed: Date.now() - startTime }; if (err) { response.err = err.message; diff --git a/lib/cartodb/monitoring/health_check.js b/lib/cartodb/monitoring/health_check.js index 1fca02b8..dd405149 100644 --- a/lib/cartodb/monitoring/health_check.js +++ b/lib/cartodb/monitoring/health_check.js @@ -1,9 +1,8 @@ var fs = require('fs'); var step = require('step'); -function HealthCheck(metadataBackend, tilelive) { - this.metadataBackend = metadataBackend; - this.tilelive = tilelive; +function HealthCheck(disableFile) { + this.disableFile = disableFile; } module.exports = HealthCheck; @@ -11,21 +10,11 @@ module.exports = HealthCheck; HealthCheck.prototype.check = function(config, callback) { - var result = { - redis: { - ok: false - }, - mapnik: { - ok: false - }, - tile: { - ok: false - } - }; + var self = this; step( function getManualDisable() { - fs.readFile(global.environment.disabled_file, this); + fs.readFile(self.disableFile, this); }, function handleDisabledFile(err, data) { var next = this; @@ -39,7 +28,7 @@ HealthCheck.prototype.check = function(config, callback) { } }, function handleResult(err) { - callback(err, result); + return callback(err); } ); };