Throttle view count updates

This commit is contained in:
Theo Browne
2026-02-22 16:35:20 -08:00
parent 797d05345a
commit 9763cdf0de
2 changed files with 18 additions and 8 deletions

View File

@@ -243,7 +243,11 @@ function broadcast() {
}
}
let viewerCountTimer: ReturnType<typeof setTimeout> | null = null;
function broadcastViewerCount() {
if (viewerCountTimer) return;
viewerCountTimer = setTimeout(() => {
viewerCountTimer = null;
const msg = JSON.stringify({
type: "viewerCount",
viewerCount: clients.size,
@@ -251,6 +255,7 @@ function broadcastViewerCount() {
for (const ws of clients) {
ws.send(msg);
}
}, 1000);
}
function getAdminSnapshot() {

View File

@@ -2,4 +2,9 @@
- [ ] Win streaks
- [ ] Experiment with more models
- [ ] Actual admin page where I enter a passkey, get a jwt and can see status, pause/resume, see costs etc
## TODO Bugfixes
- [ ] Text wrapping on long single-strings
- [ ] Stream crashing on fresh deployment (because the ffmpeg pipe dies, we should handle this in the ffmpeg script)
- [ ] Throttle view count updates