From ef7f9db9c46eaf33390ff072275d060435e5ba1c Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 28 Jan 2023 00:14:56 +0000 Subject: [PATCH] Fix stats with multiple clients. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4151 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/core.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/core.js b/core/core.js index 8cd9dbee2..cf9fcbeec 100644 --- a/core/core.js +++ b/core/core.js @@ -793,15 +793,12 @@ async function loadSettings() { } function sendStats() { - var any = false; - for (var process of Object.values(gProcesses)) { - if (process.app && process.stats) { - process.app.send({action: 'stats', stats: getStats()}); - any = true; + let apps = Object.values(gProcesses).filter(process => process.app && process.stats).map(process => process.app); + if (apps.length) { + let stats = getStats(); + for (let app of apps) { + app.send({action: 'stats', stats: stats}); } - } - - if (any) { setTimeout(sendStats, 1000); } else { gStatsTimer = false;