From e35fff59ba30e78046c9212e74fce9aef56c6e93 Mon Sep 17 00:00:00 2001 From: marzavec Date: Mon, 4 Jun 2018 00:07:24 -0700 Subject: cleaned up and commented modules --- server/src/commands/core/morestats.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server/src/commands/core/morestats.js') diff --git a/server/src/commands/core/morestats.js b/server/src/commands/core/morestats.js index 5510cb1..b64d478 100644 --- a/server/src/commands/core/morestats.js +++ b/server/src/commands/core/morestats.js @@ -12,10 +12,15 @@ const formatTime = (time) => { let hours = Math.floor(minutes / 60); minutes = minutes % 60; - return `${hours.toFixed(0)}h ${minutes.toFixed(0)}m ${seconds.toFixed(0)}s`; + + let days = Math.floor(hours / 24); + hours = hours % 24; + + return `${days.toFixed(0)}d ${hours.toFixed(0)}h ${minutes.toFixed(0)}m ${seconds.toFixed(0)}s`; }; exports.run = async (core, server, socket, data) => { + // gather connection and channel count let ips = {}; let channels = {}; for (let client of server.clients) { @@ -31,6 +36,7 @@ exports.run = async (core, server, socket, data) => { ips = null; channels = null; + // dispatch info server.reply({ cmd: 'info', text: stripIndents`current-connections: ${uniqueClientCount} @@ -44,10 +50,11 @@ exports.run = async (core, server, socket, data) => { server-uptime: ${formatTime(process.hrtime(core.managers.stats.get('start-time')))}` }, socket); + // stats are fun core.managers.stats.increment('stats-requested'); }; exports.info = { name: 'morestats', description: 'Sends back current server stats to the calling client' -}; \ No newline at end of file +}; -- cgit v1.2.1