Merge branch 'master' into standalone-server
Conflicts: lib/cartodb/cartodb_windshaft.js lib/cartodb/monitoring/health_check.js
This commit is contained in:
commit
3af2136770
@ -15,7 +15,7 @@ var versions = {
|
||||
|
||||
function ServerInfoController() {
|
||||
this.healthConfig = global.environment.health || {};
|
||||
this.healthCheck = new HealthCheck();
|
||||
this.healthCheck = new HealthCheck(global.environment.disabled_file);
|
||||
}
|
||||
|
||||
module.exports = ServerInfoController;
|
||||
@ -37,13 +37,12 @@ ServerInfoController.prototype.version = function(req, res) {
|
||||
ServerInfoController.prototype.health = function(req, res) {
|
||||
if (!!this.healthConfig.enabled) {
|
||||
var startTime = Date.now();
|
||||
this.healthCheck.check(this.healthConfig, function(err, result) {
|
||||
this.healthCheck.check(this.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;
|
||||
|
@ -1,7 +1,8 @@
|
||||
var fs = require('fs');
|
||||
var step = require('step');
|
||||
|
||||
function HealthCheck() {
|
||||
function HealthCheck(disableFile) {
|
||||
this.disableFile = disableFile;
|
||||
}
|
||||
|
||||
module.exports = HealthCheck;
|
||||
@ -9,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;
|
||||
@ -37,7 +28,7 @@ HealthCheck.prototype.check = function(config, callback) {
|
||||
}
|
||||
},
|
||||
function handleResult(err) {
|
||||
callback(err, result);
|
||||
return callback(err);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user