Merge pull request #6804 from HabitRPG/sabrecat/active-handles

Active handles logging
This commit is contained in:
Sabe Jones
2016-03-03 13:55:14 -06:00
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -10,6 +10,8 @@ var isProd = nconf.get('NODE_ENV') === 'production';
var isDev = nconf.get('NODE_ENV') === 'development';
var DISABLE_LOGGING = nconf.get('DISABLE_REQUEST_LOGGING');
var cores = +nconf.get("WEB_CONCURRENCY") || 0;
var activeHandles = require('active-handles');
var moment = require('moment');
if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
// Fork workers. If config.json has CORES=x, use that - otherwise, use all cpus-1 (production)
@@ -161,4 +163,12 @@ if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
});
module.exports = server;
var logHandlesInterval = +nconf.get('LOG_HANDLES_INTERVAL');
if (logHandlesInterval) { var activeHandleInterval = setInterval(logHandles, logHandlesInterval); }
function logHandles() {
console.log(moment().format());
activeHandles.print({highlight:false});
}
}