Throttle view count updates
This commit is contained in:
19
server.ts
19
server.ts
@@ -243,14 +243,19 @@ function broadcast() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let viewerCountTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
function broadcastViewerCount() {
|
function broadcastViewerCount() {
|
||||||
const msg = JSON.stringify({
|
if (viewerCountTimer) return;
|
||||||
type: "viewerCount",
|
viewerCountTimer = setTimeout(() => {
|
||||||
viewerCount: clients.size,
|
viewerCountTimer = null;
|
||||||
});
|
const msg = JSON.stringify({
|
||||||
for (const ws of clients) {
|
type: "viewerCount",
|
||||||
ws.send(msg);
|
viewerCount: clients.size,
|
||||||
}
|
});
|
||||||
|
for (const ws of clients) {
|
||||||
|
ws.send(msg);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAdminSnapshot() {
|
function getAdminSnapshot() {
|
||||||
|
|||||||
7
todo.md
7
todo.md
@@ -2,4 +2,9 @@
|
|||||||
|
|
||||||
- [ ] Win streaks
|
- [ ] Win streaks
|
||||||
- [ ] Experiment with more models
|
- [ ] 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
|
||||||
|
|||||||
Reference in New Issue
Block a user