Fix stats with multiple clients.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4151 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-01-28 00:14:56 +00:00
parent 0092f24fb9
commit ef7f9db9c4

View File

@ -793,15 +793,12 @@ async function loadSettings() {
} }
function sendStats() { function sendStats() {
var any = false; let apps = Object.values(gProcesses).filter(process => process.app && process.stats).map(process => process.app);
for (var process of Object.values(gProcesses)) { if (apps.length) {
if (process.app && process.stats) { let stats = getStats();
process.app.send({action: 'stats', stats: getStats()}); for (let app of apps) {
any = true; app.send({action: 'stats', stats: stats});
} }
}
if (any) {
setTimeout(sendStats, 1000); setTimeout(sendStats, 1000);
} else { } else {
gStatsTimer = false; gStatsTimer = false;