diff --git a/package.json b/package.json index ea497f587d..01f8d6bd83 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "version": "0.0.0-152", "main": "./website/src/server.js", "dependencies": { + "active-handles": "^1.1.0", "amazon-payments": "0.0.4", "amplitude": "^2.0.3", "async": "~0.9.0", diff --git a/website/src/server.js b/website/src/server.js index 494febfb97..8fc8cce0b1 100644 --- a/website/src/server.js +++ b/website/src/server.js @@ -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}); + } }