Merge branch 'master' into standalone-server

Conflicts:
	lib/cartodb/cartodb_windshaft.js
	lib/cartodb/monitoring/health_check.js
remotes/origin/overviews-widgets
Raul Ochoa 9 years ago
commit 3af2136770

@ -15,7 +15,7 @@ var versions = {
function ServerInfoController() { function ServerInfoController() {
this.healthConfig = global.environment.health || {}; this.healthConfig = global.environment.health || {};
this.healthCheck = new HealthCheck(); this.healthCheck = new HealthCheck(global.environment.disabled_file);
} }
module.exports = ServerInfoController; module.exports = ServerInfoController;
@ -37,13 +37,12 @@ ServerInfoController.prototype.version = function(req, res) {
ServerInfoController.prototype.health = function(req, res) { ServerInfoController.prototype.health = function(req, res) {
if (!!this.healthConfig.enabled) { if (!!this.healthConfig.enabled) {
var startTime = Date.now(); var startTime = Date.now();
this.healthCheck.check(this.healthConfig, function(err, result) { this.healthCheck.check(this.healthConfig, function(err) {
var ok = !err; var ok = !err;
var response = { var response = {
enabled: true, enabled: true,
ok: ok, ok: ok,
elapsed: Date.now() - startTime, elapsed: Date.now() - startTime
result: result
}; };
if (err) { if (err) {
response.err = err.message; response.err = err.message;

@ -1,7 +1,8 @@
var fs = require('fs'); var fs = require('fs');
var step = require('step'); var step = require('step');
function HealthCheck() { function HealthCheck(disableFile) {
this.disableFile = disableFile;
} }
module.exports = HealthCheck; module.exports = HealthCheck;
@ -9,21 +10,11 @@ module.exports = HealthCheck;
HealthCheck.prototype.check = function(config, callback) { HealthCheck.prototype.check = function(config, callback) {
var result = { var self = this;
redis: {
ok: false
},
mapnik: {
ok: false
},
tile: {
ok: false
}
};
step( step(
function getManualDisable() { function getManualDisable() {
fs.readFile(global.environment.disabled_file, this); fs.readFile(self.disableFile, this);
}, },
function handleDisabledFile(err, data) { function handleDisabledFile(err, data) {
var next = this; var next = this;
@ -37,7 +28,7 @@ HealthCheck.prototype.check = function(config, callback) {
} }
}, },
function handleResult(err) { function handleResult(err) {
callback(err, result); return callback(err);
} }
); );
}; };

Loading…
Cancel
Save