Adjust memory leak message to be meaningful.

Got this message in the heroku logs:
2015-11-17T04:28:18.549451+00:00 app[web.1]:  '[Memory Leak] Memory=' + parseFloat(memory).toFixed(3) + ' Time=' + moment()

Converted the line into a variable and threw that instead.
This commit is contained in:
Blade Barringer 2015-11-16 22:34:06 -06:00
parent 29c4e21b67
commit 8b7f50bfcf

View file

@ -28,7 +28,10 @@ module.exports = function(server,mongoose) {
});*/
var memory = os.freemem() / os.totalmem(),
memoryHigh = memory < 0.1;
if (memoryHigh) throw '[Memory Leak] Memory='+parseFloat(memory).toFixed(3)+' Time='+moment().format();
if (memoryHigh) {
var memoryLeakMessage = '[Memory Leak] Memory='+parseFloat(memory).toFixed(3)+' Time='+moment().format();
throw memoryLeakMessage;
}
}, mins*60*1000);
}