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() {
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;