Windshaft-cartodb/lib/cartodb/monitoring/health_check.js

20 lines
482 B
JavaScript
Raw Normal View History

2015-03-16 07:16:36 +08:00
var fs = require('fs');
2014-11-05 22:06:01 +08:00
function HealthCheck(disableFile) {
this.disableFile = disableFile;
2014-11-05 22:06:01 +08:00
}
module.exports = HealthCheck;
HealthCheck.prototype.check = function(callback) {
fs.readFile(this.disableFile, function handleDisabledFile(err, data) {
var disabledError = null;
if (!err) {
disabledError = new Error(data || 'Unknown error');
disabledError.http_status = 503;
2014-11-05 22:06:01 +08:00
}
return callback(disabledError);
});
};