From d6102284a4ed6ae28f2bf671820c8d6e45fa77a6 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Fri, 28 Aug 2015 17:41:40 +0200 Subject: [PATCH] Do not return results from health check It also removed old dependencies and takes disabled file path in ctor. --- lib/cartodb/cartodb_windshaft.js | 7 +++---- lib/cartodb/monitoring/health_check.js | 21 +++++---------------- 2 files changed, 8 insertions(+), 20 deletions(-) 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); } ); };