From f0ea1c89d334325b14030c65a19d2f00813fb99e Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 15 May 2020 15:39:16 -0700 Subject: [PATCH] Fixed device group stat counter --- meshuser.js | 6 +++++- translate/translate.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meshuser.js b/meshuser.js index a79d02c5..87c00ea1 100644 --- a/meshuser.js +++ b/meshuser.js @@ -328,9 +328,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use var os = require('os'); var stats = { action: 'serverstats', totalmem: os.totalmem(), freemem: os.freemem() }; if (parent.parent.platform != 'win32') { stats.cpuavg = os.loadavg(); } + + // Count the number of device groups that are not deleted + var activeDeviceGroups = 0; + for (var i in parent.meshes) { if (parent.meshes[i].deleted == null) { activeDeviceGroups++; } } // This is not ideal for performance, we want to dome something better. var serverStats = { UserAccounts: Object.keys(parent.users).length, - DeviceGroups: Object.keys(parent.meshes).length, + DeviceGroups: activeDeviceGroups, AgentSessions: Object.keys(parent.wsagents).length, ConnectedUsers: Object.keys(parent.wssessions).length, UsersSessions: Object.keys(parent.wssessions2).length, diff --git a/translate/translate.json b/translate/translate.json index 3a540f37..9526637a 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -31090,4 +31090,4 @@ ] } ] -} +} \ No newline at end of file