Windshaft-cartodb/lib/monitoring/health-check.js

22 lines
497 B
JavaScript
Raw Normal View History

'use strict';
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);
});
};